diff --git a/app/index.html b/app/index.html index e33a7430..cd09ae8b 100644 --- a/app/index.html +++ b/app/index.html @@ -56,17 +56,20 @@
-

Hello.

-

Welcome to Web Starter Kit. Read how to Get Started or check out the Style Guide.

+

Hello!

+

Welcome to Web Starter Kit.

+ +

Get Started.

+

Read how to Get Started or check out the Style Guide.

diff --git a/app/scripts/main.js b/app/scripts/main.js index e2c1ed64..e4fd968e 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -18,18 +18,28 @@ */ (function () { 'use strict'; + var navdrawerContainer = document.querySelector('.navdrawer-container'); var appbarElement = document.querySelector('.app-bar'); var menuBtn = document.querySelector('.menu'); + var main = document.querySelector('main'); - menuBtn.addEventListener('click', function () { - var isOpen = navdrawerContainer.classList.contains('open'); - if (isOpen) { - appbarElement.classList.remove('open'); - navdrawerContainer.classList.remove('open'); - } else { - appbarElement.classList.add('open'); - navdrawerContainer.classList.add('open'); + function closeMenu() { + appbarElement.classList.remove('open'); + navdrawerContainer.classList.remove('open'); + } + + function toggleMenu() { + appbarElement.classList.toggle('open'); + navdrawerContainer.classList.toggle('open'); + } + + main.addEventListener('ontouchstart', closeMenu); + main.addEventListener('click', closeMenu); + menuBtn.addEventListener('click', toggleMenu); + navdrawerContainer.addEventListener('click', function (event) { + if (event.target.nodeName === 'A' || event.target.nodeName === 'LI') { + closeMenu(); } - }, true); + }); })(); diff --git a/app/styles/main.css b/app/styles/main.css index 8ad21edd..9a5df6ab 100644 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -47,7 +47,8 @@ body { margin: 0 auto; } -.app-bar.open { +.app-bar.open, +.app-bar.open ~ main { -webkit-transform: translate(250px, 0); transform: translate(250px, 0); } @@ -133,15 +134,22 @@ button.menu img { backface-visibility: hidden; } +.base, p, ul, ol { + font-size: 19px; +} + .navdrawer-container { + z-index: 1; position: fixed; + top: 0; + bottom: 0; width: 250px; height: 100%; background-color: #3367D6; color: #fefefe; -webkit-transform: translate(-250px, 0); transform: translate(-250px, 0); - z-index: 1; + overflow-y: scroll; } .navdrawer-container.open { @@ -149,11 +157,23 @@ button.menu img { transform: translate(0, 0); } -.app-bar, .navdrawer-container { +.app-bar, .navdrawer-container, main { -webkit-transition: -webkit-transform 0.3s ease-out; transition: transform 0.3s ease-out; } +.navdrawer-container h4, +.navdrawer-container ul li a { + height: 60px; + padding: 0 20px; + line-height: 60px; +} + +.navdrawer-container h4 { + background-color: white; + color: #3367D6; +} + .navdrawer-container ul { padding: 0; margin: 0; @@ -162,9 +182,6 @@ button.menu img { .navdrawer-container ul li a { display: block; - height: 60px; - padding: 0 20px; - line-height: 60px; text-decoration: none; color: white; -webkit-transition: background-color 0.2s ease-out; @@ -199,6 +216,7 @@ main { margin: 0 auto; /* Height of the header */ padding: 60px 16px 16px 16px; + min-height: 100%; } /** Larger Screens - desktops and tablets **/ @@ -256,6 +274,10 @@ main { transition: none; } + .navdrawer-container h4 { + display: none; + } + .navdrawer-container ul { display: -ms-flexbox; display: -webkit-flex; @@ -274,6 +296,7 @@ main { main { max-width: 864px; padding-top: 0; + min-height: initial; } body { @@ -304,7 +327,7 @@ main { } .navdrawer-container { - padding: 0 16px 8px 16px; + padding: 0 16px; } .navdrawer-container li {