本文介绍了ArcGIS JavaScript API 3.9 - 鼠标拖动事件在Internet Explorer 11中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Internet Explorer 11中遇到鼠标拖动事件形式ArcGIS API for JavaScript 3.9的问题代码如下:

  map.on(mouse-drag,zobraudalost); 

function zobraudalost(){
alert(test);
}

问题是,此事件不会在IE 11中触发(如以及鼠标拖动开始,鼠标拖动结束)。但在其他浏览器上它工作正常(IE9,Firefox,Chrome)。另一个问题是其他鼠标事件(点击,鼠标移动等)在IE 11上正常工作,所以问题只在于鼠标拖动。



有你见过这样的问题吗?你知道IE 11中是否有一些禁用鼠标拖动事件的安全设置吗?



非常感谢你。

解决方案

嗯,这个问题与ArcGis JS API版本有关。



我只是将API 3.9更新为3.16 ,它也开始在IE中工作。



这是要验证的正在运行的fiddler链接。



https://jsfiddle.net/vikash2402/j6h00uyt/1/



我在 IE11,chrome和firefox中验证了。



  var map; require([esri / map,dojo / domReady!],function(Map){map = new Map(map,{basemap:topo,center:[ -  122.45,3.75], //经度,纬度zoom:13}); map.on(鼠标-drag,拖动); function drag(){alert(mouse-drag); }});  
  html,body,#map {height :100%;宽度:100%;保证金:0; padding:0;}  
 < link href =https ://js.arcgis.com/3.16/esri/css/esri.cssrel =stylesheet/>< script src =https://js.arcgis.com/3.16/init.js> ;< /脚本><身体GT; < div id =map>< / div>< / body>  



希望这会对您有所帮助:)


I am facing a problem with mouse-drag event form ArcGIS API for JavaScript 3.9 in Internet Explorer 11 The code is below:

map.on("mouse-drag", zobraudalost);

function zobraudalost() {
    alert("test");
}

The problem is that, this event doesn´t fire at IE 11 (as well as mouse-drag-start, mouse-drag-end). But on the other browsers it works fine (IE9, Firefox, Chrome). The other problem is that other mouse events (click, mouse-move, etc) work fine on IE 11, so the problem is only with the mouse-drags.

Have ever you seen such problem? Do you know if there is some security settings in IE 11 which disable mouse drag events?

Thank you very much.

解决方案

Well, This issue was related to ArcGis JS API version.

I simply updated the API 3.9 to 3.16 and its started working in IE too.

Here is the running fiddler link to verify.

Fiddler : https://jsfiddle.net/vikash2402/j6h00uyt/1/

I verified in IE11, chrome and firefox.

var map;

require(["esri/map", "dojo/domReady!"], function(Map) {
    map = new Map("map", {
        basemap: "topo",
        center: [-122.45, 37.75], // longitude, latitude
        zoom: 13
    });

    map.on("mouse-drag", drag);

    function drag() {
        alert("mouse-drag");
    }
});
html, body, #map {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}
<link href="https://js.arcgis.com/3.16/esri/css/esri.css" rel="stylesheet"/>
<script src="https://js.arcgis.com/3.16/init.js"></script>


<body>
    <div id="map"></div>
</body>

Hoping this will help you :)

这篇关于ArcGIS JavaScript API 3.9 - 鼠标拖动事件在Internet Explorer 11中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 16:22
查看更多