Permalink
Browse files

Clicking anywhere on page should close navigation bar

  • Loading branch information...
1 parent 317e0d2 commit 58c8ea153059e4160b41e67acfec86f53c2274df @assaf committed Dec 5, 2012
Showing with 10 additions and 9 deletions.
  1. +1 −1 doc/new/style/layout.html
  2. +2 −2 doc/new/style/zombie.css
  3. +7 −6 doc/new/style/zombie.js
@@ -7,7 +7,7 @@
<meta name="viewport" content="initial-scale = 1.0">
</head>
<body>
- <div id="navigation-bar" class="contracted">
+ <div id="navigation-bar" class="contracted" style="visibility:hidden">
<ul></ul>
<a class="expand"><span></span></a>
</div>
View
@@ -136,7 +136,7 @@ strong {
transition: all .5s ease-in-out;
}
#navigation-bar.contracted {
- height: 30px;
+ height: 28px;
}
#navigation-bar.expanded {
}
@@ -165,7 +165,7 @@ strong {
#navigation-bar li {
display: inline-block;
padding: 0;
- margin: 0 5em 0 0;
+ margin: 0 5em 6px 0;
}
#navigation-bar a {
color: #eee;
View
@@ -88,18 +88,18 @@ function pageReady() {
// Navigation bar contains an "expand me" link, clicking on it expands and
// contracts the navigation bar. This works differently in different
// browsers, but all handled by CSS magic.
- function expandNavigationBar(event) {
+ expandNavigationLink.addEventListener("click", function(event) {
if (navigationBar.className == "contracted")
navigationBar.className = "expanded";
else
navigationBar.className = "contracted";
- return false;
- }
- expandNavigationLink.addEventListener("click", function(event) {
event.stopPropagation();
event.preventDefault();
- expandNavigationBar();
- return false;
+ });
+ // Clicking anywhere else on the page, including navigation link, closes the
+ // navigation bar.
+ document.addEventListener("click", function(event) {
+ navigationBar.className = "contracted";
});
@@ -133,6 +133,7 @@ function pageReady() {
// animations?
populateNavigationLinks();
setNavigationBarHeight();
+ navigationBar.style.visibility = "visible";
}

0 comments on commit 58c8ea1

Please sign in to comment.