Added a submenu in ESC, then mobile menu loading on Desktop

Harsha Pappala
Kilo Sage

Hi Everyone, 

 

Recently added a sub menu in employee center, under the more option in the Employee Center Menu. 

The sub menu item, was added without any issues. But when portal loads now, it is automatically toggled to mobile view (hamburger view) at 100 % of chrome browser

At 100 %

HarshaPappala_0-1719985637327.png

At 90 % zoom on chrome

 

HarshaPappala_2-1719985852190.png

 

How to fix this ?

Checked that showMobileMenuOnDesktop variable in employee-center-navigation widget is coming as true. Which is resulting in this hamburger menu.

 

1 ACCEPTED SOLUTION

Harsha Pappala
Kilo Sage

We finally cloned the header widget of the Employee center (Employee Center Header) which is present in EC theme. 

Changed the below code in link part of the widget..hope this helps anyone else facing the issue

 

 var currentFontSize  = parseInt($('body').css('font-size'));
    var constantOffset = 50;
    var flexOffsetWidth = constantOffset * (currentFontSize / 16);
    if(currentFontSize < 30) { //changed from 16 to 30 to handle mobile menu
      scope.$apply(function() {
        scope.mobileDevice = controller.data.isMobile || (window.innerWidth <= controller.MOBILE_DEVICE_SCREEN_WIDTH);
      });
      return;
    }

View solution in original post

3 REPLIES 3

Yashsvi
Kilo Sage

Hi @Harsha Pappala,

please check below link:

https://www.servicenow.com/community/developer-forum/service-portal-menu-now-showing-in-mobile-brows...

Thank you, please make helpful if you accept the solution.

Hi.. I am looking into the total menu item width, not the background color of the hamburger. 

Harsha Pappala
Kilo Sage

We finally cloned the header widget of the Employee center (Employee Center Header) which is present in EC theme. 

Changed the below code in link part of the widget..hope this helps anyone else facing the issue

 

 var currentFontSize  = parseInt($('body').css('font-size'));
    var constantOffset = 50;
    var flexOffsetWidth = constantOffset * (currentFontSize / 16);
    if(currentFontSize < 30) { //changed from 16 to 30 to handle mobile menu
      scope.$apply(function() {
        scope.mobileDevice = controller.data.isMobile || (window.innerWidth <= controller.MOBILE_DEVICE_SCREEN_WIDTH);
      });
      return;
    }