tdf#100329: responsive menubar floating on left
Change-Id: I6089ed44a7920a79de7e89f1b0d884c2881d4c7c
This commit is contained in:
parent
4becb5b7e9
commit
70bbe20f95
3 changed files with 147 additions and 1 deletions
5
loleaflet/dist/loleaflet.html
vendored
5
loleaflet/dist/loleaflet.html
vendored
|
@ -40,6 +40,11 @@
|
|||
<div class="header-wrapper">
|
||||
<div id="logo" class="logo"></div>
|
||||
<nav class="main-nav" role="navigation">
|
||||
<!-- Mobile menu toggle button (hamburger/x icon) -->
|
||||
<input id="main-menu-state" type="checkbox" />
|
||||
<label class="main-menu-btn" for="main-menu-state">
|
||||
<span class="main-menu-btn-icon"></span>
|
||||
</label>
|
||||
<ul id="main-menu" class="sm sm-simple lo-menu"></ul>
|
||||
</nav>
|
||||
<div class="toolbar-wrapper">
|
||||
|
|
121
loleaflet/dist/menubar.css
vendored
121
loleaflet/dist/menubar.css
vendored
|
@ -1,5 +1,5 @@
|
|||
#main-menu {
|
||||
top: 0;
|
||||
top: 30px;
|
||||
height: 25px;
|
||||
padding-left: 125px;
|
||||
z-index: 1000;
|
||||
|
@ -58,6 +58,9 @@
|
|||
background: #538ecd;
|
||||
color: #fff;
|
||||
}
|
||||
.lo-menu > li {
|
||||
background: #efefef; /* top-level menus remain greyish */
|
||||
}
|
||||
.lo-menu > li > a:hover, .lo-menu > li > a:focus, .lo-menu > li > a:active, .lo-menu > li > a.highlighted {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
|
@ -81,6 +84,7 @@
|
|||
.lo-menu ul a span.sub-arrow {
|
||||
right: 0;
|
||||
margin-right: 5px;
|
||||
background: transparent; /* we want them to be transparent always whether mobile or desktop */
|
||||
}
|
||||
.lo-menu ul > li {
|
||||
border-left: 0;
|
||||
|
@ -95,3 +99,118 @@
|
|||
background-color: #efefef;
|
||||
}
|
||||
/* lo-menu customizations end */
|
||||
|
||||
.main-nav:after {
|
||||
clear: both;
|
||||
content: "\00a0";
|
||||
display: block;
|
||||
height: 0;
|
||||
font: 0px/0 serif;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Mobile menu toggle button */
|
||||
|
||||
.main-menu-btn {
|
||||
z-index: 2000;
|
||||
float: left;
|
||||
left: 35px;
|
||||
margin: 2px 10px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
text-indent: 21px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/* hamburger icon */
|
||||
|
||||
.main-menu-btn-icon,
|
||||
.main-menu-btn-icon:before,
|
||||
.main-menu-btn-icon:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 2px;
|
||||
height: 2px;
|
||||
width: 20px;
|
||||
background: #555;
|
||||
-webkit-transition: all 0.25s;
|
||||
transition: all 0.25s;
|
||||
}
|
||||
|
||||
.main-menu-btn-icon:before {
|
||||
content: '';
|
||||
top: -7px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.main-menu-btn-icon:after {
|
||||
content: '';
|
||||
top: 7px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
|
||||
/* x icon */
|
||||
|
||||
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon {
|
||||
height: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before {
|
||||
top: 0;
|
||||
-webkit-transform: rotate(-45deg);
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after {
|
||||
top: 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
|
||||
/* hide menu state checkbox (keep it visible to screen readers) */
|
||||
|
||||
#main-menu-state {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
|
||||
|
||||
/* hide the menu in mobile view */
|
||||
|
||||
#main-menu-state:not(:checked) ~ #main-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#main-menu-state:checked ~ #main-menu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
/* hide the button in desktop view */
|
||||
.main-menu-btn {
|
||||
position: absolute;
|
||||
top: -99999px;
|
||||
}
|
||||
/* always show the menu in desktop view */
|
||||
#main-menu-state:not(:checked) ~ #main-menu {
|
||||
display: block;
|
||||
}
|
||||
#main-menu {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,6 +316,28 @@ L.Control.Menubar = L.Control.extend({
|
|||
$('#main-menu').bind('beforeshow.smapi', {self: this}, this._beforeShow);
|
||||
$('#main-menu').bind('click.smapi', {self: this}, this._onClicked);
|
||||
|
||||
// SmartMenus mobile menu toggle button
|
||||
$(function() {
|
||||
var $mainMenuState = $('#main-menu-state');
|
||||
if ($mainMenuState.length) {
|
||||
// animate mobile menu
|
||||
$mainMenuState.change(function(e) {
|
||||
var $menu = $('#main-menu');
|
||||
if (this.checked) {
|
||||
$menu.hide().slideDown(250, function() { $menu.css('display', ''); });
|
||||
} else {
|
||||
$menu.show().slideUp(250, function() { $menu.css('display', ''); });
|
||||
}
|
||||
});
|
||||
// hide mobile menu beforeunload
|
||||
$(window).bind('beforeunload unload', function() {
|
||||
if ($mainMenuState[0].checked) {
|
||||
$mainMenuState[0].click();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this._initialized = true;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue