开发者

jump to anchor on html page from google map marker api v3

开发者 https://www.devze.com 2023-02-28 13:28 出处:网络
I would like to know how to jump to an anchor on the html page that holds a google map by clicking on a marker in the map.

I would like to know how to jump to an anchor on the html page that holds a google map by clicking on a marker in the map.

tried this:

google.maps.event.addListener(marker, 'click', function() {
    $(window).scrollTop($('#'+i+'').position().top);
    // open new infowindow
    infowindow.open(map,marker);
});

This i开发者_开发问答sn't working.. Any help is highly appreciated! Thanks!


Very belated answer as I came across this today while trying to do the same thing:

google.maps.event.addListener(marker, 'click', function() {
  window.location = "#anchor";
});
0

精彩评论

暂无评论...
验证码 换一张
取 消