-1

I'm trying to avoid that annoying zoom effect when scrolling the page.

I'm inside an iframe which show a leaflet.

I have used this code to prevent the zoom:

<div class="overlay" onClick="style.pointerEvents='none'"></div>

.overlay {
    background: transparent;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    margin-top: 49px;
}

It works fine when it comes to zoom but it also prevents the click on the navigation arrows.

Is there a way to completely disable the zoom with the mouse wheel and leave the clicks active? or even better, is there a way to make it zoom just when also the ctrl key is pressed?

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Marco
  • 1,051
  • 1
  • 17
  • 40
  • *"that annoying zoom effect when scrolling the page*" - what annoying zoom effect? – freedomn-m Apr 27 '20 at 13:52
  • 1
    when it blocks the scrolling and start zooming – Marco Apr 27 '20 at 13:53
  • never had that happen - do you have hardware problems? Is it over RDP with a slow connection? – freedomn-m Apr 27 '20 at 13:53
  • no... is an iframe which is 100% width so it takes all the page width. Same thing usually happens with google maps.. – Marco Apr 27 '20 at 13:54
  • Can you provide some HTML that demonstrates the issue? – freedomn-m Apr 27 '20 at 13:55
  • Possibly related: https://stackoverflow.com/questions/13873579/disable-zoom-in-browser-using-jquery-javascript – freedomn-m Apr 27 '20 at 13:55
  • *is a wordpress plugin which displays pdf in flipbook* - why didn't you add this **relevant** information to the question? Clearly it's the plugin that's causing the zoom, so will need configuring. Nothing to do with HTML or an iframe (other than the plugin uses an iframe). – freedomn-m Apr 27 '20 at 13:59
  • the issue is that i just do not want the mouse wheel create a zoom on an iframe.... i just want it to keep scrolling... – Marco Apr 27 '20 at 13:59
  • I didn't want to change the plugin code...to avoid problems during updates – Marco Apr 27 '20 at 14:00
  • configure != change – freedomn-m Apr 27 '20 at 14:00
  • i do not have the possibility to configure this.... this is why i said change... because there is not such a setting in the plugin – Marco Apr 27 '20 at 14:02
  • Given that we (still) have no idea what plugin you're using... not sure how we're expected to know there are no settings on the plugin. – freedomn-m Apr 27 '20 at 14:03
  • It's trivial to show that it's not the `iframe` that's causing the problem: https://jsfiddle.net/t59oryd6/ it's your plugin, which you're declining to provide information for, insisting that's it's "just an iframe". – freedomn-m Apr 27 '20 at 14:04
  • 1
    https://it.wordpress.org/plugins/interactive-3d-flipbook-powered-physics-engine/ – Marco Apr 27 '20 at 14:04
  • The documentation really isn't very good (relevant part: http://3dflipbook.net/documentation#book-control-action) but looks like you can change with cmdZoomIn/cmdZoomOut and/or set the scale property (http://3dflipbook.net/documentation#book-control-scale) so that min and max are the same so it doesn't zoom (if you only change scale, it might still stop the wheel scroll, but at least it won't zoom) – freedomn-m Apr 27 '20 at 14:13
  • Thank you! i'll try to read it... hadn't found it before... – Marco Apr 27 '20 at 14:18

1 Answers1

0

From the documentation :

Name : scrollWheelZoom
Type : Boolean|String
Default : true
Description : Whether the map can be zoomed by using the mouse wheel. If passed 'center', it will zoom to the center of the view regardless of where the mouse was.

Set scrollWheelZoom to false.

Jeremy Thille
  • 26,047
  • 12
  • 43
  • 63
  • I have the problem not on the google map.. is a wordpress plugin which displays pdf in flipbook – Marco Apr 27 '20 at 13:57