Skip to content

Commit

Permalink
script
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonSalatskyi committed Oct 17, 2016
0 parents commit 8391b7a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
26 changes: 26 additions & 0 deletions googleMaps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(function ($) {
var onMapMouseleaveHandler = function () {
var that = $(this);

that.on('click', onMapClickHandler);
that.off('mouseleave', onMapMouseleaveHandler);
that.find('iframe').css("pointer-events", "none");
}

var onMapClickHandler = function () {
var that = $(this);

// Disable the click handler until the user leaves the map area
that.off('click', onMapClickHandler);

// Enable scrolling zoom
that.find('iframe').css("pointer-events", "auto");

// Handle the mouse leave event
that.on('mouseleave', onMapMouseleaveHandler);
}

// Enable map zooming with mouse scroll when the user clicks the map
$('.yourClass').on('click', onMapClickHandler);

}(jQuery));
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>

<div class="yourClass">
<iframe style="pointer-events: none;"></iframe>
</div>

</body>
</html>

0 comments on commit 8391b7a

Please sign in to comment.