Created
May 29, 2016 21:28
-
-
Save lots0logs/8e6afdde4e5a144f529d80dbbaa09ef7 to your computer and use it in GitHub Desktop.
WordPress :: Divi Theme :: Add active class to menu item on click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function($) { | |
$(window).load(function() { | |
setTimeout(function() { | |
var $menus = $('ul.nav'); | |
$menus.each(function() { | |
var $hash_links = $(this).find('a[href*="#"]'); | |
$hash_links.each(function() { | |
$(this).on('click', function() { | |
$(this).toggleClass('current-menu-item'); | |
}); | |
}); | |
}); | |
}, 800); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment