Twitter Bootstrap3 - Make An Accordion Expand On A Different Page When A Link Is Clicked
I raised a question before about how to expand an accordion on a link click: Twitter Bootstrap 3 - Auto Expand An Accordion When A Link Clicked In Another Accordion To which I got
Solution 1:
This answer here answers your question:
Bootstrap Collapse - open the given id fragment
Put EITHER in your jQuery or JS
// === opens a collapse from a url
location.hash && $(location.hash + '.collapse').collapse('show');
OR -- not both
// === opens a collapse from a urlvar anchor = window.location.hash.replace("#", "");
$(".collapse").collapse('hide'); // REMOVE THIS it and it will work more smoothly
$("#" + anchor).collapse('show');
The latter requires a load function. $(document).ready(function() { ... });
Then link to the collapsed section with the UNIQUE id like you would normally link to an anchor:
<ahref="thepage.html#uniqueID">Link text</a>
Post a Comment for "Twitter Bootstrap3 - Make An Accordion Expand On A Different Page When A Link Is Clicked"