Skip to content

Commit

Permalink
Update magicmenu.js
Browse files Browse the repository at this point in the history
  • Loading branch information
magiccart committed Jul 13, 2021
1 parent d83af58 commit 9c0fd46
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions view/frontend/web/js/magicmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,15 @@ require(['jquery', 'easing'], function($, easing){
},

active: function (menu) {
var homeUrl = BASE_URL.replace(/\/$/, ""); /* Global variable BASE_URL from magento2 */
var currentUrl = window.location.href.replace(/\/$/, "");
if(homeUrl == currentUrl){
if($('body').hasClass('cms-index-index')){
menu.find('li.home').addClass('active');
menu.find("li:not('.home')").removeClass('active');
} else {
var currentUrl = window.location.href.replace(/\/$/, "");
menu.find("li:not('.home') a").each(function(){
var thisHref = ($(this).attr('href').split('?'))[0];
if(currentUrl.indexOf(thisHref) == 0) {
menu.find('li.home').removeClass('active');
$(this).closest('li').addClass('active');
}
});
Expand Down

0 comments on commit 9c0fd46

Please sign in to comment.