JQuery Isotope - gaps disappear when filtering with a responsive grid -
i'm working isotope create responsive gallery on http://samsnow.alwaysdata.net/galerie. looked on stackoverflow how other people did , made own piece of code need here please.
jquery(document).ready(function($){ var $container = jquery('#containergalerie'); var columns = 4, setcolumns = function() { screen = jquery(window).width(); if(screen>1630){ columns = 5; } else if(screen>1280){ columns = 4; } else if(screen>710){ columns = 3; } else if(screen>345){ columns = 2; } else{ columns = 1; }; largeur=100/columns - 0.5; jquery('.element').css('width', getlargeur); function getlargeur(){ return largeur +'%'; } }; setcolumns(); jquery(window).smartresize(function(){ setcolumns(); $container.isotope({ itemselector : '.element', resizable: false, // disable normal resizing // set columnwidth percentage of container width masonry: { columnwidth: $container.width() / columns} }); }).smartresize(); $container.imagesloaded( function(){ jquery(window).smartresize(); }); var $optionsets = jquery('.option-set'), $optionlinks = $optionsets.find('a'); $optionlinks.click(function(){ var $this = jquery(this); // don't proceed if selected /* if ( $this.parent().hasclass('active') ) { return false; }*/ var $optionset = $this.parents('.option-set'); $optionset.parent().find('.active').removeclass('active'); $this.parent().addclass('active'); // make option object dynamically, i.e. { filter: '.my-filter-class' } var options = {}, key = $optionset.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' false boolean value = value === 'false' ? false : value; options[ key ] = value; if ( key === 'layoutmode' && typeof changelayoutmode === 'function' ) { // changes in layout modes need logic changelayoutmode( $this, options ); } else { // otherwise, apply new options $container.isotope( options ); } jquery(".isotope-item a").attr("rel", "visible"); jquery(".isotope-hidden a").attr("rel", "nonvisible"); jquery(window).smartresize(); return false; }); });
since use % width images , variable number of columns i've bug on filter. after click on filter of gaps between images disappear. fixed click on filter, or sligth window resizing.
i don't understand what's happening. me please?
edit : here fiddle : http://jsfiddle.net/samsnow/8am8n/1/
i found problem : it's transition filter lot of images (my page has scrollbar) 1 few images(=no scrollbar). when scrollbar appear/disappear there no refresh! unfortunately have'nt managed fix it.
i rely on help!
Comments
Post a Comment