Guest User

Untitled

a guest
Feb 22nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. 'mouseenter .ui-menu-item': function (event) {
  2. var target = $(event.currentTarget),
  3. submenu = this.options.menus,
  4. ulElement,
  5. ulElementWidth,
  6. width,
  7. targetPageX,
  8. rightBound;
  9.  
  10. if (target.has(submenu)) {
  11. ulElement = target.find(submenu);
  12.  
  13. if (ulElement[0] && !ulElement[0].classList.contains('level0')) {
  14. var cssTop = event.target.offsetTop,
  15. ele = $(ulElement[0]);
  16. window.setTimeout(function () {
  17. ele.css('top', cssTop).animate({top: cssTop}, 20);
  18. }, this.options.delay-10);
  19. }
  20.  
  21. ulElementWidth = ulElement.outerWidth(true);
  22. width = target.outerWidth() * 2;
  23. targetPageX = target.offset().left;
  24. rightBound = $(window).width();
  25.  
  26. if (ulElementWidth + width + targetPageX > rightBound) {
  27. ulElement.addClass('submenu-reverse');
  28. }
  29.  
  30. if (targetPageX - ulElementWidth < 0) {
  31. ulElement.removeClass('submenu-reverse');
  32. }
  33. }
  34.  
  35. // Remove ui-state-active class from siblings of the newly focused menu item
  36. // to avoid a jump caused by adjacent elements both having a class with a border
  37. target.siblings().children('.ui-state-active').removeClass('ui-state-active');
  38. this.focus(event, target);
  39. },
Add Comment
Please, Sign In to add comment