Home Forums WoodMart support forum Replace Hover Trigger with onClick on Woodmart Stick Navigation Reply To: Replace Hover Trigger with onClick on Woodmart Stick Navigation

#515718

sergenadiyaman
Participant

I am trying this custom.js code and also I added custom fuction.php code
but it didnot work

`jQuery(document).ready(function($) {
// Select the sticky navigation menu item
var $stickyNavItem = $(‘.wd-sticky-nav’);

// Remove existing hover behavior
$stickyNavItem.off(‘mouseenter’).off(‘mouseleave’);

// Add click event
$stickyNavItem.on(‘click’, function() {
// Your onclick function code
// For example, toggle a class to change styles
$(this).toggleClass(‘active’);

function enqueue_custom_scripts() {
wp_enqueue_script(‘jquery’);
wp_enqueue_script(‘custom-script’, get_stylesheet_directory_uri() . ‘/js/custom.js’, array(‘jquery’), null, true);
}
add_action(‘wp_enqueue_scripts’, ‘enqueue_custom_scripts’);