Skip to content

Commit 9c0fd46

Browse files
committed
Update magicmenu.js
1 parent d83af58 commit 9c0fd46

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

view/frontend/web/js/magicmenu.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,15 @@ require(['jquery', 'easing'], function($, easing){
327327
},
328328

329329
active: function (menu) {
330-
var homeUrl = BASE_URL.replace(/\/$/, ""); /* Global variable BASE_URL from magento2 */
331-
var currentUrl = window.location.href.replace(/\/$/, "");
332-
if(homeUrl == currentUrl){
330+
if($('body').hasClass('cms-index-index')){
333331
menu.find('li.home').addClass('active');
332+
menu.find("li:not('.home')").removeClass('active');
334333
} else {
334+
var currentUrl = window.location.href.replace(/\/$/, "");
335335
menu.find("li:not('.home') a").each(function(){
336336
var thisHref = ($(this).attr('href').split('?'))[0];
337337
if(currentUrl.indexOf(thisHref) == 0) {
338+
menu.find('li.home').removeClass('active');
338339
$(this).closest('li').addClass('active');
339340
}
340341
});

0 commit comments

Comments
 (0)