It would probably be pretty easy to adapt the jQuery BBQ "jQuery UI tabs" example to meet your needs. You should take a look at the code and try to understand it, it's fairly well documented:
http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/ Basically, you decouple the action from the click, such that the click *only* changes the hash state with $.bbq.pushState(), while the action happens when the callback bound to window.onhashchange detects a hash change. So, instead of: Click -> Action You have: Click -> Push hash state -> EVENT FIRES -> Get hash state -> Action - Ben On Nov 4, 9:11 am, mehstg1319 <meh...@gmail.com> wrote: > 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?