Closed geohuz closed 8 years ago
I also wanted to do this once and couldn't figure out how to.
I finally choose to incorporate jquery-ui into it, coz I need both drag and resize, I put the logic into componentDidUpdate coz I have items dyanmically adding into the packery container,
componentDidUpdate(prevProps, prevState) {
var pckry = this.refs.pckry
// get item elements, jQuery-ify them
var $itemElems = $('.packery').find('.item')
// make item elements draggable
$itemElems.draggable().resizable();
// bind Draggable events to Packery
pckry.packery.bindUIDraggableEvents( $itemElems );
// handle resizing
var resizeTimeout;
$itemElems.on('resize', function(event, ui) {
// debounce
if ( resizeTimeout ) {
clearTimeout( resizeTimeout );
}
resizeTimeout = setTimeout( function() {
pckry.packery.fit( ui.element[0] );
}, 80 );
});
},
Could you post the complete component pls?
Especially, it would be interesting to see to what you assigned the ref=pckry..
I don't find way to implement this, I am trying to use packery.bindDraggabillyEvents(draggie) in container item Dismount event , but where can I find the instance of the packery?