-
Notifications
You must be signed in to change notification settings - Fork 12
jussi-kalliokoski/jQuery.grab
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a ported library from Jin.js::gestures. It basically allows you to have unified gesture on both touch and mouse devices to 'grab' onto objects and cast events to that. It provides the event objects with three pieces of information: * position (pageX and pageY) * move (how much mouse moved since previous event) * offset (how much mouse has moved since start) * start Example: $('div').grab({ onstart: function(e){ this.innerHTML = 'Started at ' + e.position.x + ', ' + e.position.y + '<br />'; }, onmove: function(e){ $(this).css({ left: (e.move.x < 0 ? '' : '+') + e.move.x + 'px', top: (e.move.y < 0 ? '' : '+') + e.move.y + 'px' }); }, onfinish: function(e){ this.innerHTML += 'Finished at ' + e.offset.x + ', ' + e.offset.y + '<br />'; this.innerHTML += e.passdata; }, passdata: 'The stuff got succesfully passed.' // you can name this argument whatever you like, the whole object is passed on. });
About
A port of Jin's grab gesture.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published