I’m looking to be able to hover over my Tab Links and have them change content instead of needing to click them for the Tab Panes to change. A simple change and one that I’m sure is easily resolved. I’m still fairly new to Web Flow and design. Let me know if you have any solutions!
Edit 1: My link below doesn’t show the interaction as it is. Unsure if this is intended when sharing or a visual bug on my end.
Duncan, I got this to work beautifully and easily, thank you!
Is there any Memberstack wizardry though to make the tabs also be a clickable link to a page? I’m not sure how it would be possible since it looks like the memberscript is essentially auto-clicking them on hover but I’m pretty much trying to recreate the Navbar from Boston Dynamics where their left side tabs are still clickable in their nav bar dropdowns.
I’d actually recommend using Webflow’s interactions to build a Navbar that complex. You’d have to rebuild the tab part too, but it would give you the level of flexibility you’re looking for.
… Although, I don’t think it would be too hard for me to add some code that triggers a page change on click Hmmm… I’ll add it to my list and update this thread if I have some time. Best of luck in the meantime, and thanks for the kind words
Try this code. You’ll need to add attribute ms-code-navigate=“your-page-url” to your tabs.
<script>
// Add a click event listener to elements with the ms-code-navigate attribute
document.addEventListener('click', function(event) {
const target = event.target;
// Check if the clicked element has the ms-code-navigate attribute
if (target.getAttribute('ms-code-navigate')) {
// Prevent the default behavior of the link (e.g., following the href)
event.preventDefault();
// Get the URL from the ms-code-navigate attribute
const navigateUrl = target.getAttribute('ms-code-navigate');
// Navigate to the specified URL
window.location.href = navigateUrl;
}
});
</script>
I did a quick test and everything appears to be working (Click Green to navigate to https://www.memberstack.com)
@DuncanHamra is it possible to have both: trigger tab change on hover + redirect to another page on click? It looks like if we use your 2 solutions together, the redirection will happen on hover. Thanks!
I’m afraid not as they stand today. The “change on hover” project is triggering a click which is why you’re seeing the redirect happen.
Possible solution: You might be better off building a custom UI with interactions instead of tabs. That way you can use regular links which redirect on click and then control the tab changes using the hover interaction.