Hello,
I'm trying to add the following script to the header.tpl file, but it's not working:
{literal} <script> $(document).ready(function() { if ($(".shopping-cart-wrapper").is(".show")) { $("body").addClass('dropdown-is-open'); } else { $("body").removeClass('dropdown-is-open'); } }); </script> {/literal}
Basically, I want to check if the element 'shopping-cart-wrapper' has the class 'show' and toggle the class 'dropdown-is-open' for the body if it does. But it doesn't work. I tried using 'hasClass' instead of 'is' too, but no luck. I also tried using script = text/javascript but still nothing.
Where should I add this to make it work?
Thanks!