javascript - Float list-items left when others are hidden -
javascript - Float list-items left when others are hidden -
i'm having issue list items not floating left automatically upon toggling visibility of other list items through filter.
see website , code here: http://javinladish.com/dev/
when toggle 'gloves' example, gloves should not appear in same place, instead move first slot in list.
is plugin i'm using called awesomegrid causing issue? might absolutely positioning li elements, i'm not sure.
the jquery code i'm using toggle filter , list-items is:
$(document).ready(function() { $('ul#filter a').click(function() { $(this).css('outline','none'); $('ul#filter .current').removeclass('current'); $(this).parent().addclass('current'); var filterval = $(this).text().tolowercase().replace(' ','-'); if(filterval == 'all') { $('ul.grid li.hidden').fadein('slow').removeclass('hidden'); } else { $('ul.grid li').each(function() { if(!$(this).hasclass(filterval)) { $(this).fadeout('normal').addclass('hidden'); } else { $(this).fadein('slow').removeclass('hidden'); } }); } homecoming false; }); }); how can create sure when filter list-items, float left?
thanks in advance helps out!
awesomegrid has built in property called hiddenclass, can define hidden hidden class selector, recall awesomegrid after click event. code :
$(window).load(function(){ function grid_relayout() { $('ul.grid').awesomegrid({ responsive : true, initspacing : 0, rowspacing : 28, colspacing : 28, hiddenclass : 'hidden', columns : { 'defaults' : 3, '990' : 2, '650' : 1 } }) } grid_relayout(); $('ul#filter a').click(function() { $(this).css('outline','none'); $('ul#filter .current').removeclass('current'); $(this).parent().addclass('current'); var filterval = $(this).text().tolowercase().replace(' ','-'); if(filterval == 'all') { $('ul.grid li.hidden').fadein('slow').removeclass('hidden'); } else { $('ul.grid li').each(function() { if(!$(this).hasclass(filterval)) { $(this).fadeout('normal').addclass('hidden'); } else { $(this).fadein('slow').removeclass('hidden'); } }); } grid_relayout() homecoming false; }); }) javascript jquery html css
Comments
Post a Comment