6e89bb12a35c65c0607719f2aa2c7377803d09f9 max Fri Sep 4 14:03:07 2026 -0700 Keep the top-right Login/Share a link menu icon inside the blue bar on narrow windows. On screens under 1100px the icon was positioned with position:fixed, which pins it to the top of the window. That is the top of the blue bar only on hgTracks; on hgGateway and the home page the bar sits below the logo banner, so the icon showed up in the white area above it. Use position:sticky instead, which keeps the icon in the bar on every page and still holds it at the right edge of the visible viewport while the 1000px-wide bar is scrolled sideways. The hardcoded background colour is replaced by the bar's own, which is not the same on all pages. The links now hang in their own span so that opening the menu no longer pushes the page content down, and the icon is left out entirely on mirrors that have no top-right links to show. refs #38251 diff --git src/hg/htdocs/style/nice_menu.css src/hg/htdocs/style/nice_menu.css index 0035a669a4a..66082ffab18 100644 --- src/hg/htdocs/style/nice_menu.css +++ src/hg/htdocs/style/nice_menu.css @@ -1,673 +1,682 @@ /* @font-face { font-family:"Metrophobic"; src:url(/sites/all/themes/genome/images/font/Metrophobic.ttf); src:local('Metrophobic'), url(/sites/all/themes/genome/images/font/Metrophobic.otf); } */ /* Skip navigation link for keyboard accessibility */ a.skipNav, a.skipNav:link, a.skipNav:visited { position: absolute; left: -9999px; top: 0; z-index: 1000; padding: 8px 16px; background: #003a72; color: #fff; font-size: 14px; font-weight: bold; font-family: Arial, Helvetica, sans-serif; text-decoration: none; } a.skipNav:focus { left: 0; outline: 2px solid #fff; outline-offset: -2px; } /* Contains all css needed for drop-down global navigation menus */ /* FROM Jabico's style.css */ /* body.cgi { margin:0px; padding:0px; font-size:13px; color:#6b6b6b; line-height:19px; background:#e6e3db; font-family:Arial, Helvetica, sans-serif; }*/ #main-menu-whole { width:100%; min-width:1000px; /* NOTE: must cover all top menu options, else wrapping breaks menu */ height:32px; background:#2636d1; font-family: Arial,Helvetica,sans-serif; line-height:19px; font-size:13px; margin:0 0 5px 0; position:relative; /* anchor for #topRightLinks */ } #hgTracks-main-menu-whole { width:100%; min-width:1000px; /* NOTE: must cover all top menu options, else wrapping breaks menu */ height:32px; background:#00457c; font-family: Arial,Helvetica,sans-serif; line-height:19px; font-size:13px; margin:0 0 5px 0; position:relative; /* anchor for #topRightLinks */ } /* Top-right utility links (Share a link, Login) - sit at the top-right corner of the bar, separate from the menu list. Filled by menuBar() in lib/web.c and by hgMenubar.c. */ #topRightLinks { position:absolute; top:0; right:14px; height:32px; line-height:32px; z-index:3; white-space:nowrap; } #topRightLinks a.topRightLink { color:#fff; margin-left:18px; text-decoration:none; font-family: Arial,Helvetica,sans-serif; font-size:13px; } #topRightLinks a.topRightLink:hover { text-decoration:underline; } /* Hamburger toggle: hidden on wide screens (links shown inline); shown on narrow screens below. */ #trToggle { display:none; } -/* Narrow / phone screens: the fixed-width (min 1000px) bar scrolls horizontally, so the - right-edge-pinned links would collide with "About Us". Instead pin a menu icon to the visible - viewport corner and reveal the links as a dropdown when tapped. */ +/* Narrow / phone screens: the fixed-width (min 1000px) bar scrolls horizontally, so links pinned + to the right edge of the bar end up off-screen. Instead collapse them into a menu icon that + sticks to the right edge of the visible part of the bar, and show the links as a dropdown when + it is tapped. "sticky" rather than "fixed": fixed pins to the top of the window, which is + inside the bar only on hgTracks - on pages with a logo banner above the bar (hgGateway, the home + page) it lands in the white area above it. */ @media (max-width: 1100px) { #topRightLinks { - position:fixed; - top:0; - right:0; + position:sticky; + float:right; + top:auto; + right:14px; height:32px; line-height:32px; padding:0 8px; - background:#00457c; + background:inherit; /* the bar's blue, which is not the same on all pages */ z-index:1000; } #trToggle { display:inline-block; background:none; border:0; color:#fff; font-size:20px; line-height:32px; cursor:pointer; padding:0; } - #topRightLinks a.topRightLink { + /* The links hang below the icon. They are taken out of the flow so that opening the menu + does not make the bar taller and push the rest of the page down. */ + #trLinks { display:none; + position:absolute; + top:32px; + right:0; + background:inherit; } - #topRightLinks.trOpen { - height:auto; + #topRightLinks.trOpen #trLinks { + display:block; } - #topRightLinks.trOpen a.topRightLink { + #topRightLinks a.topRightLink { display:block; margin:0; padding:8px 12px; - background:#00457c; text-align:right; } } #main-menu { /* width:1031px; */ margin-left: 30px; } /* from Jabico ... probably need to apply this to #maindiv-whole { background: url("../images/internal_bg1.jpg") repeat-x scroll left bottom #F9F9F7; } */ /* from nice_menus_default.css */ /****************************** Global CSS for ALL menu types ******************************/ ul.nice-menu, ul.nice-menu ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid #ccc; } ul.nice-menu li { border: 1px solid #ccc; border-top: 0; float: left; /* LTR */ background-color: #eee; line-height: normal; } ul.nice-menu a { padding: 0.3em 5px 0.3em 5px; } ul.nice-menu ul { top: 1.8em; left: -1px; /* LTR */ border: 0; border-top: 1px solid #ccc; margin-right: 0; /* LTR */ } ul.nice-menu ul li { min-width: 12.5em; } /****************************** HORIZONTAL (down) menus ******************************/ ul.nice-menu-down { float: left; /* LTR */ border: 0; } ul.nice-menu-down li { border-top: 1px solid #ccc; } ul.nice-menu-down li li { border-top: 0; } ul.nice-menu-down ul { left: 0; /* LTR */ } ul.nice-menu-down ul li { clear: both; } ul.nice-menu-down li ul li ul { left: 12.5em; /* LTR */ top: -1px; } ul.nice-menu-down .menuparent a { padding-right: 10px; /* LTR */ } ul.nice-menu-down li.menuparent { background: #eee; } ul.nice-menu-down li.menuparent:hover { background: #ccc; } ul.nice-menu-down li li.menuparent { background: #eee; } ul.nice-menu-down li li.menuparent:hover { background: #ccc; } #header-region ul.nice-menu-down li ul li ul { left: 12.5em; /* LTR */ top: -1px; } #header-region ul.nice-menu-down li.menuparent { background: #eee; } #header-region ul.nice-menu-down li.menuparent:hover { background: #ccc; } #header-region ul.nice-menu-down li li.menuparent { background: #eee; } #header-region ul.nice-menu-down li li.menuparent:hover { background: #ccc; } /* nice_menus.css */ /* Below should fix menu being a few pixels away in some themes, and menus disappearing behind other stuff. */ .block-nice_menus { line-height: normal; z-index: 10; } ul.nice-menu, ul.nice-menu ul { z-index: 5; position: relative; } ul.nice-menu li { position: relative; } ul.nice-menu a { display: block; } ul.nice-menu ul, /* For Garland header. */ #header-region ul.nice-menu ul { position: absolute; visibility: hidden; } ul.nice-menu li.over ul { visibility: visible; } ul.nice-menu ul li { display: block; } ul.nice-menu:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } /* Show submenus when over their parents. */ ul.nice-menu li:hover ul, ul.nice-menu li.menuparent li:hover ul, ul.nice-menu li.menuparent li.menuparent li:hover ul, ul.nice-menu li.menuparent li.menuparent li.menuparent li:hover ul, ul.nice-menu li.over ul, ul.nice-menu li.menuparent li.over ul, ul.nice-menu li.menuparent li.menuparent li.over ul, ul.nice-menu li.menuparent li.menuparent li.menuparent li.over ul, /* Repeat all this stuff just for Garland headers. */ #header-region ul.nice-menu li:hover ul, #header-region ul.nice-menu li.menuparent li:hover ul, #header-region ul.nice-menu li.menuparent li.menuparent li:hover ul, #header-region ul.nice-menu li.over ul, #header-region ul.nice-menu li.menuparent li.over ul, #header-region ul.nice-menu li.menuparent li.menuparent li.over ul { visibility: visible; } /* Hide sub-menus initially. */ ul.nice-menu li:hover ul ul, ul.nice-menu li:hover ul ul ul, ul.nice-menu li:hover li:hover ul ul, ul.nice-menu li:hover li:hover ul ul ul, ul.nice-menu li:hover li:hover li:hover ul ul, ul.nice-menu li:hover li:hover li:hover ul ul ul, ul.nice-menu li.over ul ul, ul.nice-menu li.over ul ul ul, ul.nice-menu li.over li.over ul ul, ul.nice-menu li.over li.over ul ul ul, ul.nice-menu li.over li.over li.over ul ul, ul.nice-menu li.over li.over li.over ul ul ul, /* Repeat all this stuff just for Garland headers. */ #header-region ul.nice-menu li:hover ul ul, #header-region ul.nice-menu li:hover ul ul ul, #header-region ul.nice-menu li:hover li:hover ul ul, #header-region ul.nice-menu li:hover li:hover ul ul ul, #header-region ul.nice-menu li:hover li:hover li:hover ul ul, #header-region ul.nice-menu li:hover li:hover li:hover ul ul ul, #header-region ul.nice-menu li.over ul ul, #header-region ul.nice-menu li.over ul ul ul, #header-region ul.nice-menu li.over li.over ul ul, #header-region ul.nice-menu li.over li.over ul ul ul, #header-region ul.nice-menu li.over li.over li.over ul ul, #header-region ul.nice-menu li.over li.over li.over ul ul ul { visibility: hidden; } /*************** IE 6 Fixes ***************/ /* Iframe to fix z-index bug when menu hovers over