JQuery Class Toggle -
we have simple script filter results:
$('ul.filter li a').click(function() { $('ul.filter li a').removeclass("selected"); $(this).addclass("selected"); var getvalue = $(this).attr('rel'); $('.portfoliothumbs li.all').animate({opacity:0.1}).css('pointer-events', 'none'); $('.portfoliothumbs li.'+getvalue).animate({opacity:1}).css('pointer-events', 'auto'); return false; }); basically each ul.filter link different filter button.
what want clicked filter button stay highlighted (with class of selected) know looking at, , if click filter button other filter not stay highlighted, instead highlight new filter.
we tried above kind of works, there better way?
you did right, way
$(this).addclass("selected").parent().siblings().children('a').removeclass('selected');
Comments
Post a Comment