Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单击firefox中未触发的事件(谷歌地图)_Javascript_Google Maps_Firefox_Events - Fatal编程技术网

Javascript 单击firefox中未触发的事件(谷歌地图)

Javascript 单击firefox中未触发的事件(谷歌地图),javascript,google-maps,firefox,events,Javascript,Google Maps,Firefox,Events,此代码在除firefox浏览器之外的所有浏览器中都能正常工作。 事件单击不起作用 var marker = new RichMarker({ position: new google.maps.LatLng( _latitude, _longitude ), map: map, draggable: draggableMarker, content: markerContent, flat: true });

此代码在除firefox浏览器之外的所有浏览器中都能正常工作。 事件单击不起作用

var marker = new RichMarker({
        position: new google.maps.LatLng( _latitude, _longitude ),
        map: map,
        draggable: draggableMarker,
        content: markerContent,
        flat: true
    });

google.maps.event.addListener(marker, "click", function(event) {

    alert(this.position);

});  

我怎样才能解决这个问题?Thx.

问题似乎在第615行

在内部向标记添加单击侦听器时,单击标记内容时将触发单击事件。在上面的一行中,单击事件将仅为内容的包装器触发(当标记可拖动时发生)

您需要修改函数addDraggingListeners,将其设置为:

RichMarker.prototype.addDraggingListeners_ = function() {
  var that = this;
    this.draggingListeners_ = [
      google.maps.event.addDomListener(window, 'mousemove', function(e) {
        that.drag(e);
      }, true),
      google.maps.event.addDomListener(window, 'mouseup', function() {
        that.stopDrag();
      }, true)
    ];
};

谢谢这非常有帮助!
RichMarker.prototype.addDraggingListeners_ = function() {
  var that = this;
    this.draggingListeners_ = [
      google.maps.event.addDomListener(window, 'mousemove', function(e) {
        that.drag(e);
      }, true),
      google.maps.event.addDomListener(window, 'mouseup', function() {
        that.stopDrag();
      }, true)
    ];
};