Skip to content

Commit

Permalink
feat(drawer): Close after clicking on pjax link #8
Browse files Browse the repository at this point in the history
  • Loading branch information
oswaldoacauan committed Nov 18, 2013
1 parent 4bce6b2 commit 10134a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/assets/js/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var Drawer = (function ($, Mzr) {
close: function() {
_body.removeClass('drawer-open');
},
isOpen: function() {
return _body.hasClass('drawer-open');
},
bindOverlay: function() {
_overlay.on('click', function(e) {
e.preventDefault();
Expand All @@ -46,7 +49,8 @@ var Drawer = (function ($, Mzr) {
return {
init: module.init,
open: module.open,
close: module.close
close: module.close,
isOpen: module.isOpen
};

}(jQuery, Modernizr));
6 changes: 5 additions & 1 deletion src/assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
// PJax bindings
// =================
if ($.support.pjax) {
$document.on('pjax:start', function() { NProgress.start(); });
$document.on('pjax:start', function() {
NProgress.start();
if(Drawer.isOpen())
Drawer.close();
});
$document.on('pjax:end', function() {
if(ga !== undefined) {
ga('set', 'location', window.location.href);
Expand Down

0 comments on commit 10134a3

Please sign in to comment.