Created
April 4, 2017 15:06
-
-
Save pagemashine/e4d6a58fd8f150b3d6c64be160bad88d to your computer and use it in GitHub Desktop.
sidebar js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
// sidebar | |
function showSidebar() { | |
$('.js-sidebar').addClass('l-sidebar--open'); | |
$('body').addClass('g-ovh'); | |
}; | |
function hideSidebar() { | |
$('.js-sidebar').removeClass('l-sidebar--open'); | |
$('body').removeClass('g-ovh'); | |
}; | |
$('.js-sidebar-show').on('click', function(event) { | |
event.preventDefault(); | |
showSidebar(); | |
}); | |
$('.js-sidebar-overlay').on('click', function(event) { | |
event.preventDefault(); | |
hideSidebar(); | |
}); | |
$('.js-sidebar-hide').on('click', function(event) { | |
event.preventDefault(); | |
hideSidebar(); | |
}); | |
$('.js-sidebar-menu li a').on('click', function(event) { | |
hideSidebar(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment