How can I disable scrolling on the Google Maps mobile layout?

后端 未结 8 2099
广开言路
广开言路 2020-12-08 07:07

I am developing mobile sites with Google Maps embedded via the Google Maps API. I have been able to stop certain types of behavior but have been unable to find a good way to

相关标签:
8条回答
  • 2020-12-08 07:49

    This is how I solved it with media query responsive techniques.

    HTML at the footer of the page (just above </body>):

    <div class="jrespond"></div>
    

    CSS:

    .jrespond{
      width: 30px;
    }
    
    @media only screen and (max-width: 991px){
      .jrespond{
        width: 20px;
      }
    }
    
    @media only screen and (max-width: 767px){
      .jrespond{
        width: 10px;
      }
    }
    

    JavaScript:

    if(jrespond == 10){
      // Do mobile function
    }
    
    if(jrespond == 20){    
      // Do tablet function
    }
    
    if(jrespond >= 30){
      // Do desktop function
    }
    
    **/// Google** map snippet
    var isDraggable = true;
    if(jrespond == 10){
      var isDraggable = false;
    }
    
    var myOptions = {    
      zoom: 12,
      center: myLatlng1,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      draggable: isDraggable
    }
    
    0 讨论(0)
  • 2020-12-08 07:50

    In your css:

        pointer-events: none;
    
    0 讨论(0)
提交回复
热议问题