本文介绍了右键单击Div(信息框)已禁用。我如何启用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Google Maps V3 API使用Infobox插件。



问题:当我右击信息框div , 什么都没发生。任何div都是父信息框div的孩子。但是,我有一个输入框,其中包含一些我希望能够选择的文本,然后单击右键复制。



如果我不能右击它,该怎么办?更重要的是,我该如何启用右键单击功能?



示例






JS代码 不适用

  var infoboxOptions = {
content: boxText,
disableAutoPan:true,
maxWidth:0,
pixelOffset:new google.maps.Size(0,0),
zIndex:null,
infoBoxClearance:新的google.maps.Size(5,5),
closeBoxURL:'',
isHidden:true,
pane:floatPane,
enableEventPropagation:false,
contextmenu:true
};


解决方案

我修改了infobox.js代码以使其工作。



更改此项:

  this.contextListener_ = google.maps .event.addDomListener(this.div_,contextmenu,ignoreHandler); b 




this.contextListener_ = google.maps.event.addDomListener(this.div_,contextmenu,cancelHandler);

免责声明:这可能会产生其他不良影响,因为我没有完全测试它,但它适用于我的情况。


I am using the Infobox plugin for Google Maps V3 API. http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html

Problem: When I rightclick on the infobox div, nothing happens. Same goes for any div that is the child of the parent infobox div. However I have an input box that contains some text that I want to be able to select and rightclick copy.

How can this be done if I cannot rightclick on it? More importantly, how can I enable right clicking?

Example

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/infobox-basic.html


JS Code Does not work

var infoboxOptions = {
    content: boxText,
    disableAutoPan: true,
    maxWidth: 0,
    pixelOffset: new google.maps.Size(0, 0),
    zIndex: null,
    infoBoxClearance: new google.maps.Size(5, 5),
    closeBoxURL: '',
    isHidden: true,
    pane: "floatPane",
    enableEventPropagation: false,
    contextmenu: true
    };
解决方案

I modifed the infobox.js code to get it working.

Changed this:

    this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);

to this:

    this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", cancelHandler);

DISCLAIMER: this may have other ill effects I am not aware of as I didn't test it thoroughly, but it works in my case.

这篇关于右键单击Div(信息框)已禁用。我如何启用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 06:01