Skip to content

Commit

Permalink
fixes poole#42: add js from @hnrch02 to toggle the sidebar closed whe…
Browse files Browse the repository at this point in the history
…n clicking on white space
  • Loading branch information
seon54 committed Jun 23, 2014
1 parent 0a982b1 commit 63bee61
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% include head.html %}

<body class="layout-reverse sidebar-overlay">
<body>

{% include sidebar.html %}

Expand All @@ -26,5 +26,22 @@ <h3 class="masthead-title">

<label for="sidebar-checkbox" class="sidebar-toggle"></label>

<script>
(function(document) {
var toggle = document.querySelector('.sidebar-toggle');
var sidebar = document.querySelector('#sidebar');
var checkbox = document.querySelector('#sidebar-checkbox');

document.addEventListener('click', function(e) {
var target = e.target;

if(!checkbox.checked ||
sidebar.contains(target) ||
(target === checkbox || target === toggle)) return;

checkbox.checked = false;
}, false);
})(document);
</script>
</body>
</html>

0 comments on commit 63bee61

Please sign in to comment.