Need help with a accordion
Hi folks,
I'm new to jQuery and I'm more a designer than a programmer, so the solution for my problem might be simple for you guys.
please check out this site for an example:
http://www.lichtathlet.de/portfolio-fotos-portraits.php
Please have a look at the menu on the left.
My goal is to make the already opened tab-title to be not not clickable when the page loads. It already works when you click on antother tab, but if you load the page the titles are clickable.
here's my code:
-
$(document).ready(function(){
$("#subnavi dd").hide();
$("#subnavi dd.first").show();
$("#subnavi dt a").click(function(){
if ($(this).parent().next("dd").css("display")!="block") {
$("#subnavi dt a").removeClass("cursor");
$(this).addClass("cursor");
$("#subnavi dd").slideUp("slow");
$(this).parent().next().slideDown("slow");
}
return false;
});
$("#subnavi #impressum dd").show ();
$('.backtotop').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
});
});
A short explanation:
Class "cursor" changes the mouse from pointer to default, so it seams
to the user that the opened element isn't clickable.
I already tried this (but it didn't worked)
-
$("#subnavi dd.first").parent().next("dt a").addClass("cursor");
I hope you guys can help me out.
Thank you in advance for your effort.
Mike
PS:
English is not my native language, I hope you guys got it anyways
