shortArchives/js/accordion.js
2015-04-25 20:38:55 +02:00

18 lines
736 B
JavaScript

$(document).ready(function(){
$(".shortArchives li ul:not(:first)").hide();
$(".shortArchives li span").each( function () {
var txt = $(this).text();
$(this).replaceWith('<a href="" class="archives-year">' + txt + '<\/a>') ;
} ) ;
$(".shortArchives li a.archives-year").click(function(){
if ($(this).next(".shortArchives li ul:visible").length != 0) {
$(".shortArchives li ul:visible").slideUp("normal", function () { $(this).parent().removeClass("open") });
} else {
$(".shortArchives li ul").slideUp("normal", function () { $(this).parent().removeClass("open") });
$(this).next("ul").slideDown("normal", function () { $(this).parent().addClass("open") });
}
return false;
});
});