jquery - Isotope, Meteor, hasClass returning false? -
if (meteor.isclient) { template.articles.rendered = function () { var container = $('.articles'); var antiiso = $(container.find(".article:not(.isotope-item)")); if( container.children().length > 0 ) { if ( !container.hasclass("isotope") ) { console.log(container); console.log(container.hasclass("isotope")); container.isotope({ // options itemselector : '.article', layoutmode : 'fitrows' }); } else if (container.hasclass("isotope") && antiiso.length > 0) { console.log("updating isos"); container.isotope('additems', antiiso, function() { container.isotope(); }); } } }
console output:
<div class="articles isotope" style="position: relative; overflow: hidden; height: 281px; ">…</div> false
am missing blatantly obvious here? understanding container should have class isotope?
i have realized console.log not work way imagined, although 3 times appears has class isotope console.log showing me end result of object every time.
therefore code acting correctly did not appear though was. editing code below fixed issue:
if (meteor.isclient) { template.articles.rendered = function () { var container = $('.articles'); var antiiso = $(container.find(".article:not(.isotope-item)")); if( container.children().length > 0 ) { if ( !container.hasclass("isotope") && antiiso ) { container.isotope({ // options itemselector : '.article', layoutmode : 'fitrows' }); } else if (container.hasclass("isotope") && antiiso.length > 0) { console.log("updating isos"); container.isotope('additems', antiiso, function() { container.isotope(); }); } } }
Comments
Post a Comment