rotation - Using jQuery to rotate an element on swipe/drag -
i wish have circle rotates along users swipe/gragging across screen. using phonegap create app, , have thought using hammer.js lot of people recommend it.
i have seen loads of posts clicking div rotate 90 degrees etc.. easy, require users swipe or drag gesture can rotate element in "real-time". in element rotate speed of swipe , finger touching screen - giving native feel.
any ideas?
im using plugin work nice. can handle multi finger swipe/drag drag start/end ecc
https://github.com/mattbryson/touchswipe-jquery-plugin
here working code example:
$(function() { $("body").swipe( { swipe:function(event, direction, distance, duration, fingercount, fingerdata) { if(direction=="right" && fingercount==2 && distance>100){ //do } else if(direction=="right" && distance>100){ //do other.... } else if(direction=="left" && distance>100){ //other , other.... } }, threshold:0, fingers:'all' }); $('body').swipe("option","allowpagescroll","vertical"); }); jquery rotation hammer.js rotatetransform
No comments:
Post a Comment