Note that there are some explanatory texts on larger screens.

plurals
  1. POIsotope & Media Queries
    primarykey
    data
    text
    <p>Absolutely pulling my hair out on this one. There seems to be no black and white solution offered on <a href="https://github.com/desandro/isotope/issues/271" rel="nofollow">GitHub</a> - which is strange, since it seems like a fairly simple concept. Perhaps I just don't get it.</p> <p>Basically, I am trying to create a <strong>fluid</strong> and <strong>responsive</strong> portfolio - using <a href="http://isotope.metafizzy.co/" rel="nofollow">Isotope</a> to filter the items. The filtering works fine, the 4 columns are totally fluid and everything looks great when you resize the window.</p> <p><strong>HOWEVER</strong>, for mobile and tablet layouts, I simply need to adapt from a <strong>4-column</strong> layout to a <strong>2-column</strong> layout.</p> <p>I tried this:</p> <pre><code>$(window).load(function(){ var $container = $('#thumbs'); $container.isotope({ filter: '*', animationOptions: { duration: 750, easing: 'linear', queue: false, }, }); // initialize Isotope $container.isotope({ // options... resizable: false, // disable normal resizing // set columnWidth to a percentage of container width masonry: { columnWidth: $container.width() / 4 }, }); // update columnWidth on window resize $(window).smartresize(function(){ $container.isotope({ // update columnWidth to a percentage of container width masonry: { columnWidth: $container.width() / 4 } }); }); // My attempt at using media queries to change 'columnWidth' $(window).resize(function() { var width = $(window).width(); if (width &lt; 768) { $container.isotope( { // update columnWidth to half of container width masonry: { columnWidth: $container.width() / 2 } }); } }); }); </code></pre> <p>Didn't work :(</p> <p>Any help would be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload