- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在使用 Google Maps API v3 和使用 InfoBox 插件时遇到问题,特别是关于这个可用性问题用例:
由于我的 map 需要在将鼠标悬停在每个相应标记上时打开自定义信息框,因此本地图上有 2 个非常接近的标记时,即使/如果其中一个标记位于信息框后面当前在悬停另一个附近的标记后打开,当鼠标悬停在它的标记上时触发它(即使它在当前打开的信息框后面)并且另一个信息框阻碍当前/以前打开的信息框
我已按照此处另一位发帖人的问答过程进行操作:Google Maps API v3 Event mouseover with InfoBox plugin并遵循了推荐的代码,但我无法全神贯注于如何防止打开的信息框后面的标记在该信息框关闭之前不被触发。
var gpoints = [];
function initializeMap1() {
var Map1MileLatLang = new google.maps.LatLng(39.285900,-76.570000);
var Map1MileOptions = {
mapTypeControlOptions: {
mapTypeIds: [ 'Styled']
},
mapTypeControl: false,
zoom: 14,
center: Map1MileLatLang,
//mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeId: 'Styled'
};
var Map1Mile = new google.maps.Map(document.getElementById("map_canvas"), Map1MileOptions);
var styledMapType = new google.maps.StyledMapType(styles, { name: 'Styled' });//new
Map1Mile.mapTypes.set('Styled', styledMapType);//new
for ( var i=0; i<5; i++ ) {
gpoints.push( new point(Map1Mile) );
gpoints.push( new point2(Map1Mile) );
}
function popup(_point) {
_point.popup = new InfoBox({
content: _point.content,
pane: 'floatPane',
closeBoxURL: '',
alignBottom: 1
});
_point.popup.open(_point.marker.map, _point.marker);
google.maps.event.addListener(_point.popup, 'domready', function() {
//Have to put this within the domready or else it can't find the div element (it's null until the InfoBox is opened)
$(_point.popup.div_).hover(
function() {
//This is called when the mouse enters the element
},
function() {
//This is called when the mouse leaves the element
_point.popup.close();
}
);
});
}
function point(_map) {
this.marker = new google.maps.Marker({
position: new google.maps.LatLng(39.291003,-76.546234),
map: _map
});
this.content = '<div class="map-popup" style="width:100px;"><div class="map-popup-window"><div class="map-popup-content"><a href="http://www.google.com/">Just try to click me!</a><br/>Hovering over this text will result in a <code>mouseout</code> event firing on the <code>map-popup</code> element and this will disappear.</div></div>';
// Scope
var gpoint = this;
// Events
google.maps.event.addListener(gpoint.marker, 'mouseover', function() {
popup(gpoint);
});
}
function point2(_map) {
this.marker = new google.maps.Marker({
position: new google.maps.LatLng(39.295003,-76.545234),
map: _map
});
this.content = '<div class="map-popup" style="width:100px;"><div class="map-popup-window"><div class="map-popup-content"><a href="http://www.google.com/">Just try to click me!</a><br/>Hovering over this text will result in a <code>mouseout</code> event firing on the <code>map-popup</code> element and this will disappear.</div></div>';
// Scope
var gpoint = this;
// Events
google.maps.event.addListener(gpoint.marker, 'mouseover', function() {
popup(gpoint);
});
}
经过实验,我怀疑这个问题与 z-index 无关...我理解这需要在 javascript 中捕获是否正确?
如有任何帮助或建议,我们将不胜感激!
最佳答案
为标记添加 optimized: false 属性应该可以解决问题。
this.marker = new google.maps.Marker({
position: new google.maps.LatLng(39.295003,-76.545234),
map: _map,
optimized: false
});
关于javascript - 当标记位于打开的信息框后面时 - 使用 InfoBox 插件 Google Maps API v3 事件鼠标悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7691088/
有一个使用 Google Maps API 的 Vue.js + Typescript 项目,尝试将 infobox.js(npm 包 google-maps-infobox-window)库导入并在
我正在使用 Mediawiki 制作 wiki。我在其他 wiki 上看到过每个页面的右侧栏。 像这样:http://minecraft.gamepedia.com/Diamond_Ore 右侧栏包含
我在 Outlook 2013 中从其他帖子中拼凑出这个测试程序。 它应该会显示一个弹出框,然后在 3 秒后关闭。 它永远不会关闭。 Sub MessageBoxTimer() Dim Ack
有没有办法在 shinydashboard 上的 infoBox 上使用自定义图标。我正在尝试使用 hrbrmstr gist 上的示例但是我找不到更新 infoBox 函数的地方。 library(
我一直在尝试结合 JQuery 创建这种新闻 slider 。我不关心让交互正常工作,但我的信息框是一个 div,包含“Prev”和“Next” anchor 标记,但不会调整大小以适应其父 div
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关于您编写的代码问题的问题必须在问题本身中描述具体问题 — 并且包括有效代码 以重现它。参见 SS
我正在尝试从大多数汽车页面中删除有用的信息框,但是我弄乱了语法。从其他有用的 SO 帖子中,我找到了一种抓取标准 Infobox 模板的便捷方法(给出的示例是氢): https://en.m.wiki
我想要一个信息框显示两行文本。例如,如果我要结合 html 和 和 Shiny (就像传单中的弹出窗口一样): output$myInfoBox ", "Output2: ", myout2, sep
我使用库 Shinydashboard 来编写我的 ui.R。在我的dashboardBody部分,我写道: fluidRow(infoBoxOutput("dri")) 然后在我的 server.R
这个问题困扰我好久了。我不断收到此错误: Uncaught TypeError: Object # has no method 'open' 这篇文章中的解决方案也无济于事。 Uncaught Typ
我在使用信息框时遇到了一些问题 - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/refere
我正在尝试从我的 csv 文件中获取一系列国家/地区的官方语言。 我正在用 python 和 BeautifulSoup 解析页面以从维基百科获取数据(例如 https://en.wikipedia.
我一直在研究 InfoBox 文档和这篇文章 here尝试让 InfoBox 看起来与标准 InfoWindow 几乎一样,以此作为一些细微外观变化的起点。 正如您在 this fiddle 中看到的
我这里有一张 map 、标记和信息框。 现在我想用 jquery dialog() 和模态窗口更改信息框...我该怎么做? 这是我的信息框代码 google.maps.event.addListen
我对如何实现信息框有疑问,想知道是否有人对可能的解决方案有深入的了解。 目前我有大约 1000 个客户端标记,它们都被动态添加到页面中。它们是使用以下内容生成的。 var cir = new goo
我在 React 应用程序中遇到 google maps InfoBox 的问题。我的目标是在谷歌地图实例上打开一个空的 InfoBox,然后使用 ReactDOM.render 将我的组件放入其中。
我知道这与谷歌地图 API 有关,但不确定如何删除/出售错误。有谁请赐教?当我进行搜索时,它专门出现在 Wordpress 上。 https://www.madhatgirls.com/ Failed
设置 我有a polygon map of all the Provinces in South Africa . 然后将其作为 FusionTablesLayer 拉入 v3 Google map
我正在尝试选择 使用 jquery 的 $('#divname')在点击 map 上的许多标记中的任何一个时,Google map 生成的信息框内。 问题:当我尝试使用 $("#gallery") 访
我正在使用信息框。我能够加载所有标记,在每个信息框中加载不同的内容,然后“正确”触发。然后从哪里开始问题: 1) 在桌面/iOS 上,我的 Toggle 事件仅在第二次单击后起作用。基本上它上下移动一
我是一名优秀的程序员,十分优秀!