isotope icon indicating copy to clipboard operation
isotope copied to clipboard

hide elements with filter on load

Open dimios opened this issue 15 years ago • 8 comments

hello, i am using this $container.isotope({ itemSelector: '.element', masonry : {columnWidth : 260}, filter: '.menu, .about' });

to hide elements on load but first loads all the elements and then when te script its called hides them. Is there any way to be hidden until call them through the filter? Or at least can be everything in the isotope container hidden untill is script ready?

thanks for this amazing script

dimios avatar May 20 '11 04:05 dimios

http://cparliaros.com here is my website, you can see that in the first 2 seconds (on my pc) you can see all the elements and then when the script is ready they will be hide.

p.s. only the filter: about, filmography and contact have elements so far, in order to test it.

dimios avatar May 20 '11 13:05 dimios

You only need to apply CSS to the items you want to hide. See: http://jsfiddle.net/desandro/KWvME/

Here I am hiding the blue items. So in my CSS I set

.blue {
  opacity: 0;
}

Now blue items will be hidden before the script kicks in. Isotope works as it normally would. I filter for the other items, .red, .green here.

$container.isotope({
  itemSelector: '.item',
  masonry : { columnWidth: 70 },
  filter: '.red, .green'
});

desandro avatar May 20 '11 13:05 desandro

oh, i see, because isotope uses already opacity to hide them. I added that to my http://cparliaros.com/css/style.css but again you can see them on the load of the page, again very fast but visibly. http://cparliaros.com Is it maybe because they are more "heavy" element to load?

dimios avatar May 20 '11 13:05 dimios

Looks good to me. It think the problem is that the logo is slightly taller than the other menu items (150px vs 139px) which is throwing off your layout.

desandro avatar May 20 '11 13:05 desandro

which element has height 139px? the 4 first elements which are on the first row has the same height:150px (logo, navigation bar and social media). I gave a background image now to the logo http://cparliaros.com in order to be more visible the height next to others. But I am interesting to fix this throwing off, can you please tell me how this happening? if its not to much to ask and thanks for your help already.

dimios avatar May 20 '11 14:05 dimios

The second item. It has height 139 + 5px padding + 5px padding = 149 pixels tall. You need to set its height to 140px.

desandro avatar May 20 '11 14:05 desandro

thanks

dimios avatar May 20 '11 15:05 dimios

sorry to comment on this old post;

this method seems to break the back button.

ie. when clicking an ahref in a filtered isotope layout (which would take you to another page) and one goes back (via backbutton), the filter is reinitialised by this method.

bakman2 avatar Jan 21 '14 05:01 bakman2