-
Notifications
You must be signed in to change notification settings - Fork 385
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
contain top-down, not bottom-up #185
Labels
Comments
desandro
changed the title
a bug when shiz is heigher than the container
contain top-down, not bottom-up
Mar 9, 2018
Thanks for reporting this bug. I'll add a fix for this in the next release. Until then you can fix this by adding this code: function applyGrid( value, grid, method ) {
method = method || 'round';
return grid ? Math[ method ]( value / grid ) * grid : value;
}
Draggabilly.prototype.containDrag = function( axis, drag, grid ) {
if ( !this.options.containment ) {
return drag;
}
var measure = axis == 'x' ? 'width' : 'height';
var rel = this.relativeStartPosition[ axis ];
var min = applyGrid( -rel, grid, 'ceil' );
var max = this.containSize[ measure ];
max = applyGrid( max, grid, 'floor' );
return Math.max( min, Math.min( max, drag ) );
}; |
desandro
added a commit
that referenced
this issue
Mar 9, 2018
okay thanks |
🎉 Draggabilly v2.2.0 has been released with a fix for this issue. 🎉 Please update! Closing this as resolved. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://codepen.io/zzzgit/pen/wyLjYN
when the content is heigher than the container, the title will be unreachable after a dragging action.
what i want is keeping the title alway in the container to make sure i can drag it anytime
could you tell me how to modify the source code?
The text was updated successfully, but these errors were encountered: