Home › Forums › JavaScript › [Solved] SlideToggle Trouble › Re: [Solved] SlideToggle Trouble
@noahgelman Thanks,
Here is my current code:
$(“#explore-nav ul”).hide();
$(“#explore-nav li a”).not(“#explore-nav ul a”).click(function() {
var curList = $(“#explore-nav li a.current”).attr(“rel”);
$(this).parent().find(“ul”).stop().slideToggle(“normal”);
// List moving to
var $newList = $(this);
// Set outer wrapper height to height of current inner list
var curListHeight = $(“300”).height();
$(“300”).height(curListHeight);
// Remove highlighting – Add to just-clicked tab
$(“#explore-nav li a”).removeClass(“current”);
$newList.addClass(“current”);
// Figure out ID of new list
var listID = $newList.attr(“rel”);
if (listID != curList) {
// Fade out current list
$(“#”+curList).fadeOut(300, function() {
// Fade in new list on callback
$(“#”+listID).fadeIn();
// Adjust outer wrapper to fit new list snuggly
var newHeight = $(“#”+listID).height();
$(“300”).animate({
height: newHeight
});
});
}
// Don’t behave like a regular link
return false;
});
});
@jamy_za
Thanks, i’ll try that accordion thing