0

Is there a way to limit panning maybe by 50% of the image. For example while panning the image, if 50% of image is out of screen/panning area, then stop panning in that direction.

Check this demo for the behaviour which I am looking for.

Community
  • 1
  • 1
ifadey
  • 1,062
  • 10
  • 12

1 Answers1

0

Just use inverted containment http://timmywil.github.io/jquery.panzoom/demo/#inverted-contain and adjust the whitespace around the element to stop when panning in a particular direction.

potatopeelings
  • 40,709
  • 7
  • 95
  • 119
  • Although it seems to work in some cases like on the demo page, it seems to be buggy. I could not get it to work in my context, and event contain: true is buggy since version 1.3.4. See my post here about this: https://github.com/timmywil/jquery.panzoom/issues/283#issuecomment-255447634 – Jean-François Beauchamp Oct 21 '16 at 19:45
  • Yea, not working well for me at all either. Hopefully he fixes soon... do you know if there's a way to cancel panning from the `panzoomstart` event? – Steel Nation Oct 21 '16 at 19:52