-
Hello
I have problems with Easy Table of Contents
Accordions work fine if ACCORDION ITEM has proper anchor
The same doesn’t work with TABS. I can open the from single link but not from TOC. Is there any solution?https://manualcmp.cz/genblocks-tabs/
Thank you, David
-
Hi David,
the ID needs to be added to the tab item, you need to manually do that.
https://docs.generateblocks.com/article/adding-html-anchors-for-tabs/ -
dgold
Hello, I think I have it right, but it’s not functioning, if it is called from TOC
-
It’s set up correctly, and it should work.
I see that the h5 in the tab button, has the same id as the tab item, any chance you can remove that? As you have 2 same IDs on the same page, it would not work.
https://app.screencast.com/irHhMIuqdEP3U -
dgold
Hi, Ying
I turned off smooth scroll (even tried another TOC plugin)
In editor, the tab button has no anchor. I turned off any other plugins, still not working….(: -
Alvind
Hi there,
It seems like you have two identical IDs on the page. They should be added only to the tab items.
https://postimg.cc/QBj1KSfs -
Hello, but the second ID is added by TOC, not by me. And tab with MR angiography works, if it is triggered from text link.
Problem is, that tabs (UZ, X-ray) are not opened from table of content.
David -
Alvind
Hmm, it seems like the issue lies with the TOC plugin.
You mentioned trying another TOC plugin. Have you tried this one: https://wordpress.org/plugins/simpletoc/
Since they claim it’s compatible with GeneratePress, it’s worth a try.
-
I added a simple TOC and encountered the same problem. Accordions open correctly, but tabs do not respond.
-
David
Hi there,
it won’t matter which ToC plugin you use.
The issue is the ToC will generate a set of links for any H* elements on the page, and it will attach an Anchor to each of those headings.
And the Tab block requites that anchor to be elsewhere.So it would need some Javascript.
Use a GP Hook element to hook this script into the
wp_footer
of your site. Set the Display Rules to the pages you require it on:<script> document.addEventListener('DOMContentLoaded', function() { // Get all anchor tags with href starting with '#' var jumpLinks = document.querySelectorAll('a[href^="#"]'); // Iterate through each jump link jumpLinks.forEach(function(link) { // Add click event listener to each jump link link.addEventListener('click', function(event) { // Get the target id from href attribute var targetId = link.getAttribute('href').substring(1); // Find the target element by id var targetElement = document.getElementById(targetId); // Check if the target element exists if (targetElement) { // Check if the target element's parent has a role="button" var parentElement = targetElement.parentElement; if (parentElement.getAttribute('role') === 'button') { // If found, trigger a click event on the button parentElement.click(); } } }); }); }); </script>
When a ToC link is clicked, this script will “click” the Tab Button that is associated with the heading anchor.
-
dgold
Hello, David
great, this works! Thank you very much for superb support and software
David
- You must be logged in to reply to this topic.