Trying to use jQuery slideDown() on a Woocommerce child theme
-
As the title suggests I have a woocommerce child theme and I’m trying to get the nav elements to slide down on mouseover and up on mouseout.
My JS is below.
$('.menu-item-has-children').mouseover(function() { $('.sub-menu').slideDown(); });
My HTML is structed roughly like this.
<div class="storefront-primary-navigation"> <div class="col-full"> <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="Primary Navigation"> <button class="menu-toggle" aria-controls="site-navigation" aria-expanded="false"> <span>Menu</span> </button> <div class="primary-navigation"> <ul id="menu-nav" class="menu"> <li id="menu-item-13" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-13"> <a href="https://www.highwest.com/spirits">Drink</a> <ul class="sub-menu"> <li id="menu-item-18" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18"> <a href="https://buy.highwest.com/products/american-prairie-bourbon">American Prairie Bourbon</a></li> <li id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19"><a href="https://buy.highwest.com/products/double-rye-2">Double Rye!</a></li> <li id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-20"><a href="https://www.highwest.com/spirits.php">Barrel Finished Cocktails</a> <ul class="sub-menu">
I’m not sure why this simple piece of jQuery is not working unless it has to do with Storefront overwriting what I’m trying to implement.
From everything I’ve been able to find online people just say to use the slideDown() function on wordpress so I haven’t come across anything stating that it shouldn’t work.
My other JS is functioning and the JS I wrote for my other site functions as well.
I am not new to coding but I am new to wordpress development so any help would be greatly appreciated. I’m sure I’m missing something simple but I can’t figure out what, and haven’t been able to come across the answer online.
The page I need help with: [log in to see the link]
- The topic ‘Trying to use jQuery slideDown() on a Woocommerce child theme’ is closed to new replies.