0

I have added a Google maps but have been unsuccessful to disable the hover zoom in on scroll

<?php 
if ( is_page('/items/location/') ) {
echo '<div style="background:transparent;position:relative; width:100%;height:700px; top:700px;margin-top:-700px;" onClick="style.pointerEvents="none""></div><iframe src="https://www.google.com/maps/d/embed?mid=zlgfUzUXXQsY.kAAoJD6JIpRw" width="100%" height="700px" ></iframe>';}
?>

I tried adding a div element over it and such tricks but none worked so far.

Any help is much appreciated

Nec
  • 178
  • 2
  • 16

1 Answers1

1

I had the same problem once, I solved it easily like this:

<?php 
    if ( is_page('/items/location/') ) {
        echo '<div style="background:transparent;position:relative; width:100%;height:700px; top:700px;margin-top:-700px;" onClick="style.pointerEvents=\'none\'"></div>
<iframe src="https://www.google.com/maps/d/embed?mid=zlgfUzUXXQsY.kAAoJD6JIpRw" width="100%" height="700px" ></iframe>';
    } 
?>

This way, when you just scroll the mouse over it, the zoom won't work; However, when you click on the map, the zoom is enabled.

mariobgr
  • 2,143
  • 2
  • 16
  • 31
  • something like this ? http://stackoverflow.com/questions/19874289/google-maps-iframe-disable-scrolling-touch-on-mobile – Nec Apr 15 '15 at 10:33
  • exactly! did you try this? – mariobgr Apr 15 '15 at 10:34
  • sorry for the late reply, as you can see i did, i just did not use class but style and added the css into style – Nec Apr 15 '15 at 11:19
  • sadly simce im using php, if statement and echo , onClick="style.pointerEvents='none'" is kiling the content , unexpected quotation – Nec Apr 15 '15 at 11:22
  • I updated the answer - you can escape the single quotes using `\'string\'` – mariobgr Apr 15 '15 at 11:39