ICEfaces
  1. ICEfaces
  2. ICE-3658

Prevent menus from displaying off the top of the browser viewport

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      all

      Description

      When a menubar is displayed at the right border of the browser window, the menu is shown outside of the window so that the user needs to scroll in order to see the menu.
      This should be avoided by showing the menu on the left side of the menubar instead of the right side.

      A patch to menu.js that works for us (not thoroughly tested):
       show: function(supermenu,submenu,submenuDiv) {
           supermenu=$(supermenu);
           submenu=$(submenu);
           submenuDiv=$(submenuDiv);
      if (submenu) {
      var menu = $(submenu);
      //menu is already visible, don't do anything
                  if (menu && menu.style.display=='') return;
                  Ice.Menu.showMenuWithId(submenu);
                  if (submenuDiv) {
                       // ICE-3196
                      var left;
                                      //check if menu is too far to the right
      if (Ice.Menu.getPosition(supermenu,'Left')+supermenu.offsetWidth+submenu.offsetWidth>document.documentElement.scrollLeft+document.body.clientWidth){
      left=-submenu.offsetWidth;
      }else{
      left=supermenu.offsetWidth;
      }
                                     //check if menu is too far on the botton
      var top=0;
      if (Ice.Menu.getPosition(supermenu,'Top')+submenu.offsetHeight>document.documentElement.scrollTop+document.body.clientHeight){
      top=-submenu.offsetHeight+supermenu.offsetHeight;
      }
                      submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:top, offsetLeft:left});
                      submenu.clonePosition(submenuDiv, {setTop:false, setLeft:false, setWidth:false, setHeight:false});
                  } else {
                       // ICE-3196
                      submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:supermenu.offsetHeight});
                  }
                  Ice.Menu.showIframe(submenu); // ICE-2066, ICE-2912
      }
              Ice.Menu.currentMenu = submenu;
          },
      1. ScreenHunter_01.jpg
        77 kB
      2. ScreenHunter_01.jpg
        70 kB
      3. ScreenHunter_05.jpg
        69 kB

        Issue Links

          Activity

            People

            • Assignee:
              yip.ng
              Reporter:
              Stefan Niederhauser
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: