Skip to content

socialblogsite/mapScrollPrevent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mapScrollPrevent

License MIT jQuery v0.5.3 Wordpress v0.1.0 Website Link

mapScrollPrevent is an easy solution to the problem of page scrolling with new "Google Maps Iframe Embed". This jQuery and Wordpress plugin prevents Google Maps iframe from capturing the mouse's scrolling wheel / touch scrolling behavior wrapping the <iframe> with a transparent <div> on mouse / touch hover, so you must click / tap them to activate the normal navigation.

mapScrollPrevent

Check the Live Demo!. Use it, enjoy it and please contribute to make it better.

You can Download a Pre-Release version. If you are finding the wordpress version check the Wordpress Branch

Table of contents

Examples

For usage examples check the live demo.

Usage

  1. Include jQuery and mapScrollPrevent Libs in your html.

    <head>
    // jQuery Google CDN
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js?ver=2.1.3"></script>
    // mapScrollPrevent rawgit CDN
    <script type="text/javascript" src="https://cdn.rawgit.com/diazemiliano/mapScrollPrevent/master/dist/mapScrollPrevent.js"></script>
    </head>
  2. Call mapScrollOff including the following code.

    <script type="text/javascript">
    $(function() {
      // Only Google Maps Selector
      var googleMapSelector = "iframe[src*=\"google.com/maps\"]";
      $(googleMapSelector).mapScrollPrevent();
    });
    </script>
  3. Edit defaults.

    <script type="text/javascript">
    $(function() {
      // Only Google Maps Selector
      var googleMapSelector = "iframe[src*=\"google.com/maps\"]";
      var options = {
                  hoverMessage:"<p>My custom message.</p>"
                };
      $(googleMapSelector).mapScrollPrevent(options);
    });
    </script>

Default Options

// JavaScript
var options = {
      // Custom class for map wrap
      wrapClass:"map-wrap",
      // Custom class for hover div
      overlayClass:"map-overlay",
      // Hover Message
      overlayMessage:"<p>Has <b>Clic</b> para Navegar el Mapa.</p>",
      // Removes mapScroll
      stop:false
    };

License

The MIT License (MIT)

Copyright (c) 2015 Emiliano Díaz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

mapScrollPrevent is an easy solution to the problem of page scrolling with Maps.This plugin prevents a Google Maps iframe from capturing the mouse's scrolling wheel behavior.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 65.5%
  • HTML 34.5%