Created
November 12, 2020 17:31
-
-
Save Andrii-Yukhymenko/9ecf0c398df12f056ca9658cfe709bb0 to your computer and use it in GitHub Desktop.
Проверка текущей страницы и подсветка активного пункта меню
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
let pagePathName = location.pathname.split('/').slice(-1)[0]; | |
if(pagePathName == ""){ | |
pagePathName = 'index.html' | |
}; | |
console.log('pagePathName = '+ pagePathName); | |
$(`.header__menu-item a[href="${ pagePathName }"]`).addClass('header__menu-item_selected'); | |
$(`.footer__menu-item a[href="${ pagePathName }"]`).addClass('header__menu-item_selected'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment