Created
April 3, 2016 15:36
-
-
Save romreed/f3523e945c980e714d419ca273b54021 to your computer and use it in GitHub Desktop.
jQuery Accordeon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JS: | |
$(".accordeon dd").hide().prev().click(function() { | |
$(this).parents(".accordeon").find("dd").not(this).slideUp().prev().removeClass("active"); | |
$(this).next().not(":visible").slideDown().prev().addClass("active"); | |
}); | |
CSS: | |
.accordeon .active { color: red } | |
HTML: | |
<div class="accordeon"> | |
<dl> | |
<dt>Заголовок</dt> | |
<dd>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam ea, accusamus. Numquam non commodi ipsum debitis repudiandae amet vero itaque, deserunt, ad neque libero quae officia. Facilis non, possimus doloribus! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquid quis voluptatem repellat? Blanditiis iste, exercitationem porro, magni amet cupiditate enim, labore tenetur, praesentium quam consequuntur nesciunt. Culpa dicta adipisci voluptatem.</dd> | |
</dl> | |
<dl> | |
<dt>Заголовок</dt> | |
<dd>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquid quis voluptatem repellat? Blanditiis iste, exercitationem porro, magni amet cupiditate enim, labore tenetur, praesentium quam consequuntur nesciunt. Culpa dicta adipisci voluptatem.</dd> | |
</dl> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment