Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var url = window.location.href;
- jQuery('.main-nav li').each(function(){
- if (jQuery(this).find(".sub-nav").length > 0){
- var menu_item = jQuery(this).find('.sub-nav a').attr('href');
- }
- else {
- var menu_item = jQuery(this).find('a').attr('href');
- }
- if (menu_item == url) {
- jQuery(this).addClass('active');
- console.log(menu_item);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement