Improve navbar UX logic for #233

This change takes us away from using overflow:hidden on body by
default, only toggling this using a new `open` class when the navbar
has been expanded. `open` is toggled on body in the same places as it
is for the appear and navdrawer.
master
Addy Osmani 2014-07-03 11:22:37 +01:00
parent 637ebc2233
commit e446c797db
2 changed files with 7 additions and 1 deletions

View File

@ -22,16 +22,19 @@
var querySelector = document.querySelector.bind(document);
var navdrawerContainer = querySelector('.navdrawer-container');
var body = querySelector('body');
var appbarElement = querySelector('.app-bar');
var menuBtn = querySelector('.menu');
var main = querySelector('main');
function closeMenu() {
body.classList.remove('open');
appbarElement.classList.remove('open');
navdrawerContainer.classList.remove('open');
}
function toggleMenu() {
body.classList.toggle('open');
appbarElement.classList.toggle('open');
navdrawerContainer.classList.toggle('open');
}

View File

@ -20,10 +20,13 @@ body {
font-weight: 300;
background-color: #FFFFFF;
box-sizing: border-box;
overflow: hidden;
min-height: 100%;
}
body.open {
overflow: hidden;
}
.app-bar {
display: block;
width: 100%;