Skip to content

scroll past google map iframe on content intensive web pages

Notifications You must be signed in to change notification settings

josheche/itsatrap.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

itsatrap.js

#####Develop content intensive websites #####without getting trapped in google map scroll hell

alt text

##SET UP

  • ok add the itsatrap.js file or copy and paste it from the example below or toss it in a script tag idc you're an adult i can't tell you how to live your life
$(document).ready(function () {
 
  // pointer only allowed on.click and pointer is none on document.ready
  // and then set the pointer events true on click
  $('#iframeMap').addClass('scroll-off');
  $('#map').on('click', function () {
    $('#iframeMap').removeClass('scroll-off');
  });

  // disable pointer when the mouse leaves the map with unique id #iframeMap
  // and then set the pointer to none when mouse leaves the map area
  $("#iframeMap").mouseleave(function () {
    $('#iframeMap').addClass('scroll-off');
  });
});
  • then call it with this html markup (assuming you styled the section with a custom class called .map)
<section id="map" class="map">
  <iframe id="iframeMap" src="https://www.google.com/maps/embed/code/goes/here/duh" width="1200" height="420" frameborder="0" style="border: 0"></iframe>
</section>
  • dont forget to add the css in your custom stylesheet:
.scroll-off { pointer-events: none; }

##TO DO:

1. get better at writing documentation

alt text

About

scroll past google map iframe on content intensive web pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published