Tuesday, 15 April 2014

jquery - Set first child element to inactive state -



jquery - Set first child element to inactive state -

hi have code , whant have first accordion closed. whints on how create work?

jquery(document).ready(function() { jquery('.accordion .container').hide(); jquery('.accordion .trigger:first-child').addclass('active').next().show(); jquery('.accordion .trigger').click(function() { if(jquery(this).next().is(':hidden')) { jquery(this).parent().find(".trigger").removeclass('active').next().slideup('fast'); jquery(this).toggleclass('active').next().slidedown('fast'); } homecoming false; });

});

change this:

jquery('.accordion .trigger:first-child').addclass('active').next().show();

to:

jquery('.accordion .trigger').first().removeclass('active').hide().next().addclass('active').show();

jquery

No comments:

Post a Comment