javascript - jQuery unable to use Sortable with Isotope -
javascript - jQuery unable to use Sortable with Isotope -
i trying create table of items sortable, using jquery ui's native sortable
option, sortable based on criteria, using isotope plugin (here).
here's fiddle: http://jsfiddle.net/sa5yh/4/. find out, here isotope works fine, clicking button indeed sorts expected. jquery ui sortable
not work, can drag it, 1 time released, returns original position. without isotope
use, works fine, expected: http://jsfiddle.net/sa5yh/5/. thought how create both work?
isotope adds style attibute position restrictions, mentioned in reply well.
here cure: http://jsfiddle.net/zd6mt/4/
//an event handler when isotope done reordering elements $container.isotope( 'on', 'layoutcomplete', function( isoinstance, laidoutitems ) { var n = laidoutitems.length; (var = n-1; >= 0; i--) { //starting lastly element in list //moves them origin of parent tag //so in end elements sorted //and style properties can removed $('.test').prepend(laidoutitems[i].element); } //remove styles applied isotope $('.bookmark').removeattr('style'); $container.isotope('destroy'); } );
basically can utilize sorted list generated isotope perform sorting of children elements jquery ui sortable do.
once in place, don't need styling constraints isotope had forced.
so 1 time animation isotope over, first sort children, , strip them style attrbute (assuming had not added else straight elements, of course of study - otherwise, strip position:absolute
css rule within style attribute)
edit must destroy isotope object after every reordering, otherwise mess-up
javascript jquery jquery-ui jquery-isotope
Comments
Post a Comment