[jQuery] Jquery Accordion and History
Hey
Trying to implement JQuery on a website I am working on, basically,
the whole front page is one big accordion and clicking on the various
bars opens and closes the sections. Like this example.
This all works perfectly, but like all javascript, if the user clicks
the back button, it does not keep a history of the changes.
I understand there are plugins like Jquery History and Jquery-BBQ that
I can use, but I cannot work out how to implement them!
The code I wrote for my accordion is as follows:
Code:
$(document).ready(function(){
$(".bodyText").hide();
$("a h3").click(function(){
if($(this).is('.active')) {
$(this).toggleClass("active");
$(this).parent().parent().next(".bodyText").slideToggle();
return false;
} else {
$(".bodyText:visible").slideUp("slow");
$("h3.active").removeClass("active");
$(this).toggleClass("active");
$(this).parent().parent().next(".bodyText").slideToggle();
return false;
}
});
});
Pretty simple code really, and does what I want. Just want to get some
kind of history, so if the user uses the back button, they nav back
through the site.
Any ideas?
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home