admin管理员组文章数量:1290187
I have a Google Map that suddenly stopped working for no apparent reason (I hadn't touched the code for months, but the wrapper code from our CMS may have changed without Corporate telling me).
(sorry about the nasty HTML outside the map, most of that es from our corporate parent...)
I've narrowed it down to this part of my drawMarker
function:
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html, { maxWidth: 500 });
});
Of note:
alert(html);
displays the correct HTML for the infowindow.- The HTML in the html variable is indeed valid.
- The click event is firing (confirmed by
alert('test');
within it) - Another map I host on the same site works fine, despite similar code.
- No JavaScript errors in Firebug or IE that I can see.
I've been bashing my head against this for a while. What am I missing?
I have a Google Map that suddenly stopped working for no apparent reason (I hadn't touched the code for months, but the wrapper code from our CMS may have changed without Corporate telling me).
http://www.democratandchronicle./section/builder
(sorry about the nasty HTML outside the map, most of that es from our corporate parent...)
I've narrowed it down to this part of my drawMarker
function:
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html, { maxWidth: 500 });
});
Of note:
alert(html);
displays the correct HTML for the infowindow.- The HTML in the html variable is indeed valid.
- The click event is firing (confirmed by
alert('test');
within it) - Another map I host on the same site works fine, despite similar code.
- No JavaScript errors in Firebug or IE that I can see.
I've been bashing my head against this for a while. What am I missing?
Share Improve this question asked Oct 22, 2008 at 18:23 ceejayozceejayoz 180k41 gold badges310 silver badges381 bronze badges 1- I am having the same problem despite the fact that I changed the API version I am still not able to make it work. How did you eventually resolve the issue ? – Omayr Commented Jul 26, 2011 at 13:00
5 Answers
Reset to default 2I've had random problems with Google Maps API at times and more than once it has been fixed by going back one API version. i.e. if your google maps API javascript inclusion string is like this http://maps.google./maps?file=api&v=2.xd&key=XXXXX
change the 2.x to something a few versions back (back when it was working) like 2.132 or something
try:
GEvent.addListener(marker, 'click', function() {
this.openInfoWindowHtml(html, { maxWidth: 500 });
});
remember the scope of the object "marker" is outside your function
I recently had this issue, event handlers definitely ran, etc. Turned out there were two instances of the Google Maps <script> tag on the page. Removing one fixed it.
Try forcing JavaScript to make a new variable out of your HTML:
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html+'', { maxWidth: 500 });
});
This resolved itself. I suspect an update to the API broke something for a version or two.
本文标签: javascriptGoogle Maps APIGMarkeropenInfoWindowHtml() stopped workingStack Overflow
版权声明:本文标题:javascript - Google Maps API - GMarker.openInfoWindowHtml() stopped working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741483528a2381297.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论