I have a page with 7 sections of information contained in a Javascript accordion. The accordion sections are opened by making a function call with an index contained in it. ie: runAccordion(3); I would like to link to this page from other areas of my site and have the appropriate accordion open when the page loads. Linking to the page as www.domain.com/page.php#myAccordion just places the appropriate accordion at the top of the page but does not open it. Is there a way to pass a parameter to be processed on page load and then call the right function?
Asked
Active
Viewed 405 times
1 Answers
0
Call a function onLoad or with jQuery document.ready that gets document.location.href and parses the query string parameters. See How can I get query string values in JavaScript? for an example.
The URL to your page would be www.domain.com/page.php?myAccordion=3