Skip to content

Instantly share code, notes, and snippets.

@pagemashine
Created April 4, 2017 15:06
Show Gist options
  • Save pagemashine/e4d6a58fd8f150b3d6c64be160bad88d to your computer and use it in GitHub Desktop.
Save pagemashine/e4d6a58fd8f150b3d6c64be160bad88d to your computer and use it in GitHub Desktop.
sidebar js
$(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