简体   繁体   English

如何使用jquery + gmap3库将Google地图位置设置为固定

[英]how to have Google Maps position set to fixed using the jquery + gmap3 library

I have been struggling to make position fixed for the google maps div even when I tried appending events on the gmap3 library using on like $('#map-google').gmap3({}).on(tilesloaded: function(){}) trying to apply this answer but it doesnt work and I have spend like 3 hours doing this. 即使我尝试在gmap3库上使用on $('#map-google').gmap3({}).on(tilesloaded: function(){})附加事件,我一直在努力为谷歌地图div设置位置$('#map-google').gmap3({}).on(tilesloaded: function(){})尝试应用这个答案 ,但它不工作,我已经花样3时间做这个。 So I'm going to leave my founds here for someone having the same issue. 因此,我将把我的创始人遗留给有同样问题的人。

Serching on internet there's an answer using vanilla javascript but none using jquery and the gmap3 library 在互联网上提供使用vanilla javascript的答案,但没有使用jquery和gmap3库

For those three to work you gotta put it in this way 对于那三个人来说,你必须这样做

$('#map-google').gmap3({
        map: {
            options:{
              center:center,
              scrollwheel: false,
              zoom: 12
            },
            events: {
               tilesloaded: function(){
                  $('#map-google').css('position','fixed')
            }
         },
    },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM