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
Options Grid snap on dragEnd #65
Comments
Interesting idea. Here's a hack that does it: http://codepen.io/desandro/pen/gbYELj |
Yiiiiiiiiaaaaah now thats cool, thanks a lot man ! |
hmm behaves crazy on webkit browsers and great on firefox.. hmm |
I'll leave that implementation up to you. |
Well thank you sir. |
I've updated the code so it's not munging with var draggie = new Draggabilly('.draggie');
var grid = [ 40, 40 ];
draggie.on( 'dragEnd', function() {
draggie.position.x = applyGrid( draggie.position.x, grid[0] );
draggie.position.y = applyGrid( draggie.position.y, grid[1] );
draggie.setLeftTop();
}); or with jQuery var $draggable = $('.draggie').draggabilly();
var draggie = $draggable.data('draggabilly');
var grid = [ 40, 40 ];
$draggable.on( 'dragEnd', function() {
draggie.position.x = applyGrid( draggie.position.x, grid[0] );
draggie.position.y = applyGrid( draggie.position.y, grid[1] );
draggie.setLeftTop();
}); |
Aaahh cool man, looks great, thanks a lot !!
|
Hi man,
Is it possible to add/set the "grid" option on "dragEnd", so the object
is free to move outside of the "grid", and when you release it on "dragEnd"
it adapts and snaps into place (grid).
If you have a solution without digging around in core files or
maybe motivation to add a new option for this it would be seriously super duper amazing mega
awesome...
Best regards /
Monk
The text was updated successfully, but these errors were encountered: