user interface - jQuery Masonry and UI Sortable -
there's website i'm developing can found here. it's photography website , client asked me implement allow move photos around , change order of appear. come mysql database , displayed jquery masonry.
i thought instantly of jquery ui sortable, , i've been trying implement absolutely no luck @ all. how can achieve this? can point me in right direction, please?
thanks in advance!
i struggling same issue, far answer has been change classes jquery's sortable start, stop, change , sort events. so:
$('#sortable').sortable({ start: function(event, ui) { console.log(ui); ui.item.removeclass('masonry'); ui.item.parent().masonry('reloaditems') }, change: function(event, ui) { ui.item.parent().masonry('reloaditems'); }, stop: function(event, ui) { ui.item.addclass('masonry'); ui.item.parent().masonry('reloaditems'); });
here working example , js fiddle on subject. it's start.
however, not 'presto' solution, examples work older versions of masonry, latest version has few bugs implementing since "reload" method replaced layout() , reloaditems(). or... can use old masonry versions, if works you.
alternatively can use jquery.shapeshift(), you're looking for.
Comments
Post a Comment