javascript - isotope layout not updating on first page load -


i'm using isotope plugin, reading items data json. have bug on first load of page (with clear cache) layout height not updating, causing in attached image. enter image description here when selecting category works fine, , when refreshing page works fine. heres of code:

$(document).ready(function() {    window.addeventlistener("load", function() {    // init isotope    var $grid = $('.grid').isotope({        filter: '.e-commerce',        itemselector: '.element-item',        layoutmode: 'fitrows',        getsortdata: {              name: '.name',              symbol: '.symbol',              number: '.number parseint',              category: '[data-category]',              weight: function( itemelem ) {                  var weight = $( itemelem ).find('.weight').text();                  return parsefloat( weight.replace( /[\(\)]/g, '') );             }        }   });  

after init call function renderelement reads json data , insert elements using : $(".grid").isotope('insert',$(elementhtml)); //insert new elements isotop gallery

it looks this:

$.getjson("js/data.json",function(data){           renderelement(data);   }); 

heres link page: http://demo.minglebutton.net/minglebuttondemo/index.html

thanks.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -