New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling across pandzoom content #211
Comments
I needed this behavior as well. It would be nice if there was a flag "panOnlyWhenZoomed" that you could set that would allow you to swipe past panzoom when already at the minScale and only enable panning when zoomed in. In the meantime you can fake the functionality pretty easily by checking whether the panzoom is scaled up past your minScale value and setting the disablePan accordingly. I tested this on iOS devices and in a variety of the Chrome device emulators and it seems to work fine: // Set up panzoom container, making sure to disablePan by default
var $panzoom = $(".panzoom").panzoom({
minScale: 1,
disablePan: true
});
// After a zoom event, check zoomed state and reset the disablePanning
$panzoom.on('panzoomzoom', function(e, panzoom, scale, options) {
$panzoom.panzoom("option", "disablePan",
Math.abs(scale - options.minScale) < 0.0001);
}); Edit: Tweaked it a bit to work in both properly in non-touch and made it a bit slimmer |
I agree. This function is very important, otherwise the lib is kinda useless .. especially on smaller touch devices. |
Hello,
I would like scroll by swipping across the pandzoom content.
In my project the image has width: 100% of viewport, and when my Inch is on the pandzoom image, nothing appened, logic. But have you any tip for allow the scroll despite pandzoom ?
Example : When the image hasn't yet zoom ? when the image has zoom but the image is blocked by the limits of parent container ? When the scroll represent a certain percentage from bottom to top ?
Than'ks you
The text was updated successfully, but these errors were encountered: