Archived topic
Custom icon for menu not working properly
7 replies · Started by jose on January 11, 2020
I have an icon in the menu (added directly in wordpress menu title)
<div id="nav-icon1">
<span></span>
<span></span>
<span></span>
</div>
with
$(document).ready(function(){
$('#nav-icon1,#nav-icon2,#nav-icon3,#nav-icon4').click(function(){
$(this).toggleClass('open');
});
});
but doesnt work properly. When u click it transform to "X", it should make the animation on click. But when you customize generatepress primary menu in "click - element", the icon doesnt do nothing. "Open" should be added as a class in id="nav-icon1" div element, never happens.
Hi there,
try replacing all $ with jQuery
No not working, anyway the code its inside jQuery( function( $ ){};
This is out of our scope - but i am happy to take a look at the site if you can share a link ?
Just i am working in local... :(
Anyway, i have a child-theme, can i modify js/dropdown-click.js?
After this,
How can i do to stop calling the old js/dropdown-click.js in the parent theme and call the js/dropdown-click.js in the child theme.
THX
Hi there,
You can add your own dropdown-click.js file to your child theme, and remove the old one like this:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_script( 'generate-dropdown-click' );
} );
Let me know if you need more info :)
I tried but generatepress stil load the js (/js/dropdown-click.min.js v2.4.1)
I tried wp_dequeue_script( 'generate-dropdown-click' ); just above the 5x wp_enqueue_script that i have registered.
Can you share your full wp_enqueue_scripts function with me?