- This topic has 5 replies, 2 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
February 28, 2023 at 9:41 am #2550273
Gary
I’ve been playing around with the new GB tabs which are very flexible and I can see lots of applications for. I’ve been looking into whether they could be used to create more advanced menus and they seem to work well but there is one limitation currently as you can only trigger a tab change on click/tap.
Wondering if there’s any way they could be triggered on hover to more closely resemble a typical hover navigation by way of a filter or whether there’s any plans to allow this?
Thanks
February 28, 2023 at 10:34 am #2550356David
StaffCustomer SupportHi there,
not really, as the HTML, Scripts and CSS that Tabs require is completely different to that of a navigation.
Is this hypothetical “navigation” for within the content or is it to be found in the usual places ?
February 28, 2023 at 10:47 am #2550372Gary
Hi David
No the content in question is not for regular page use which was the reason for the enquiry.
Essentially I’m trying to create some mega menu elements using GP block elements, hooking it in to certain navigation sub menu items. Got that part working after some trial and error, however now in my mega menu panels I need some dropdown style menus to show hide menu items within the block and I was thinking I might be able to utilise the new tabs features as it has most of what I need apart from the hover effect.
Appreciate the tabs markup would not be a traditional format for creating a menu, but as the intended use is inside a mega menu the content in this block is quite custom as a result.
Thanks
February 28, 2023 at 11:19 am #2550413David
StaffCustomer SupportAh ok.
In that case you could try triggering a click on hover with some Javascript.
Something like this:const tabButtons = document.querySelectorAll('.gb-tabs__button'); tabButtons.forEach((tabButton) => { tabButton.addEventListener('mouseover', () => { tabButton.click(); }); });You may want to change the
.gb-tabs__buttonclass to something more specific.February 28, 2023 at 1:46 pm #2550540Gary
Thanks David, that helps a lot. I’ll work with this example and hopefully get the hover effect working to make the tabs appear more menu like.
Cheers
March 1, 2023 at 12:46 am #2550916David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.