demeritrious Posted August 11, 2014 Share Posted August 11, 2014 Any help on this would been very much appreciated. I am trying find a way to save the state of the JQuery accordions on my webpage after a user refreshes or changes webpages within my website. I have tried installing different scripts and downloading different cookie plugins but they either don't work or breaks all of the jquery functions on my webpage. Thank you. This is in my header <head> <link rel="stylesheet" type="text/css" href="css/styles.css"> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"> <script src="js/jquery.js"></script> <script src="js/jquery-ui.js"></script> <script type="text/javascript" src="Cookies/jquery.cookie.js"></script> </head> My Html <div id="History"> <!---Images---> <p>Today In History</p> <div> <script type="text/javascript" src="http://rss.brainyhistory.com/link/historyevents.js"></script><small><i>more <a href="http://www.brainyhistory.com/" target="_blank">History</a></i></small> </div> </div> This is my original JQuery code $( "#History" ).accordion({ collapsible: "true", heightStyle: "content" }); Quote Link to comment https://forums.phpfreaks.com/topic/290399-accordion-save-state-after-referesh/ Share on other sites More sharing options...
fastsol Posted August 11, 2014 Share Posted August 11, 2014 You'd have to either use the new html5 local storage method and have an if() in your jquery to check the status of that OR do the same kind of method with php sessions. The later will require an ajax call to set the session everytime they select a accordion option. Quote Link to comment https://forums.phpfreaks.com/topic/290399-accordion-save-state-after-referesh/#findComment-1487454 Share on other sites More sharing options...
demeritrious Posted August 11, 2014 Author Share Posted August 11, 2014 I have no idea how to do either. Is there a script or demo that you know of? Quote Link to comment https://forums.phpfreaks.com/topic/290399-accordion-save-state-after-referesh/#findComment-1487455 Share on other sites More sharing options...
Frank P Posted August 16, 2014 Share Posted August 16, 2014 (edited) I have no idea how to do either. Is there a script or demo that you know of? It's not easy, and it's a native-JS tutorial, but it is described here. On the other hand, it uses cookies, which would be easier than the PHP method. Edited August 16, 2014 by Frank P Quote Link to comment https://forums.phpfreaks.com/topic/290399-accordion-save-state-after-referesh/#findComment-1487953 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.