【问题标题】:how to have Google Maps position set to fixed using the jquery + gmap3 library如何使用 jquery + gmap3 库将 Google Maps 位置设置为固定
【发布时间】:2017-07-06 09:22:28
【问题描述】:
即使我尝试使用 on like 在 gmap3 库上附加事件时,我也一直在努力为 google maps div 固定位置
$('#map-google').gmap3({}).on(tilesloaded: function(){}) 试图申请 this answer 但它不起作用,我花了大约 3 个小时来做这件事。
所以我要把我的发现留给有同样问题的人。
【问题讨论】:
标签:
jquery
google-maps-api-3
css-position
fixed
jquery-gmap3
【解决方案1】:
在互联网上搜索有一个使用 vanilla javascript 的答案,但没有一个使用 jquery 和 gmap3 库的答案
为了让这三个起作用,你必须这样说
$('#map-google').gmap3({
map: {
options:{
center:center,
scrollwheel: false,
zoom: 12
},
events: {
tilesloaded: function(){
$('#map-google').css('position','fixed')
}
},
},