Skip to content

Commit aec0ab0

Browse files
author
Ihor Melnychenko
committed
MAGETWO-27300: Category menu items go out of screen when page side is reached
- fixed delay function and improved sub-menu reverse
1 parent 3960c42 commit aec0ab0

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

lib/web/mage/menu.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,24 @@ define([
333333
}
334334
},
335335
"mouseenter .ui-menu-item": function (event) {
336-
var target = $(event.currentTarget);
337-
338-
if(target.has('ul')){
339-
var ulElement = target.find('ul'),
340-
ulElementWidth = target.find('ul').outerWidth(true),
341-
width = target.outerWidth()*2,
342-
targetPageX = target.offset().left,
343-
rightBound = screen.width;
344-
345-
if((ulElementWidth + width + targetPageX)>rightBound){
336+
var target = $(event.currentTarget),
337+
ulElement,
338+
ulElementWidth,
339+
width,
340+
targetPageX,
341+
rightBound;
342+
343+
if (target.has('ul')) {
344+
ulElement = target.find('ul');
345+
ulElementWidth = target.find('ul').outerWidth(true);
346+
width = target.outerWidth() * 2;
347+
targetPageX = target.offset().left;
348+
rightBound = screen.width;
349+
350+
if ((ulElementWidth + width + targetPageX) > rightBound) {
346351
ulElement.addClass('submenu-reverse');
347352
}
348-
if(targetPageX - ulElementWidth<0){
353+
if ((targetPageX - ulElementWidth) < 0) {
349354
ulElement.removeClass('submenu-reverse');
350355
}
351356
}

0 commit comments

Comments
 (0)