HTML Embed load on Tab

Hey guys,

I have a custom code embed on the second of three tabs.

It has an animation but it defaults to run when the page loads. How do I get the embedded code to run only when the tab is selected?

Thanks!

You need to wrap your code in a jQuery click function on the tab

https://api.jquery.com/click/

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("tablink").click(function(){
        $(this).location.reload(true);
    });
});
</script>

Hey samliew. I tried the above script where tablink is the name of my tab link class. Unfortunately nothing happens. Do you have any suggestions?

Thanks,

You do not need to load jQuery if your code is placed in the footer code box, as Webflow already imports one. Loading a second one may cause conflicts.

This is an invalid selector, as there is no element tagname called “tablink”. Did you mean to use a classname or ID selector?

This doesn’t run animations, in fact, it doesn’t do anything.