Plugin Contributor
Tracy Levesque
(@liljimmi)
🏳️🌈 YIKES, Inc. Co-Owner
Thread Starter
Enzo
(@enzorabante)
Thanks for the answer.
I already tried that and unfortunately is not working.
I removed the scroll portion, not required.
Having more than 1 tab on that link, may be I should change something on that script?
Hi @enzorabante,
Can you provide the script you are using? I’m not seeing it in my browser tools.
Thanks,
Jon
Thread Starter
Enzo
(@enzorabante)
Let’s try again now on this url:
https://www.daycoaftermarket.com/en/product/timing-belts/#tab-video
I’m loading a dedicated tabs.js file
-
This reply was modified 3 years, 9 months ago by
Enzo.
Hi @enzorabante,
If you just want something to activate the tab when the hash is in the current URL, the following should work:
jQuery(document).ready(function($) {
if (window.location.hash) {
const {
hash
} = window.location;
if (hash.includes('#tab-')) {
const title = hash.replace('#tab-', '#tab-title-');
const titleElement = document.querySelector(title);
titleElement.querySelector('a').click();
}
}
});
Let me know if that helps,
Jon
Thread Starter
Enzo
(@enzorabante)
That works now, thanks.
Now just looking to understand how keep the page scrolled Top by default without scrolling automatically to the Tab div
Hi @enzorabante,
It looks like your theme is doing some interesting stuff with the scroll position at the top of the dayco.js file. You might take a look at that.
Jon