Pinch ZoomIn/ZoomOut effect on Image using JqueryMobile

怎甘沉沦 提交于 2019-12-23 15:17:56

问题


I have to add functionality of Pinch ZoomIn/Out effect on image using jqueryMobile Plugin, can any one help?

Thanks alot,

--Brock


回答1:


It is possible on jQuery Mobile, but you will need to use a 3rd party implementation called hammer.js.

It supports a large number of gestures like:

  • hold
  • tap
  • doubletap
  • drag, dragstart, dragend, dragup, dragdown, dragleft, dragright
  • swipe, swipeup, swipedown, swipeleft, swiperight
  • transform, transformstart, transformend
  • rotate
  • pinch, pinchin, pinchout
  • touch (gesture detection starts)
  • release (gesture detection ends)

Example:

$('#test_el').hammer().on("pinchin", ".nested_el", function(event) {
    console.log(this, event);
});

$('#test_el').hammer().on("pinchout", ".nested_el", function(event) {
    console.log(this, event);
});

It works with jQuery Mobile, and that is important. But you should think of some other idea, or at least another idea for Android 2.X devices, because that platform doesn't support multitouch events.

There are also some other 3rd party implementations, like Touchy. Unfortunately, Touchy only supports pinch.



来源:https://stackoverflow.com/questions/16424686/pinch-zoomin-zoomout-effect-on-image-using-jquerymobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!