Am I able to deep link to a tab inside Accordion?
For example, let's say I am clicking a link such as http://domain.com/page#tab-23 from an external source – how can I make tab 23 active/opened when the page is loaded?
There is a deep_linking option for Tabs, but not for Accordion.
Thanks.
It's not the most elegant but you could look for a hash in the URL and trigger a click on the corresponding accordion element.
JS
if(window.location.hash) {
var hash = window.location.hash;
$('.accordion a[href="' + hash + '"]').trigger('click');
}
Here's a working demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With