ready for staging
This commit is contained in:
parent
72da90a5d4
commit
8506be5194
236 changed files with 16119 additions and 6 deletions
50
public/assets/vendor/OffCanvasMenuEffects/js/main.js
vendored
Normal file
50
public/assets/vendor/OffCanvasMenuEffects/js/main.js
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* main.js
|
||||
* http://www.codrops.com
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Copyright 2014, Codrops
|
||||
* http://www.codrops.com
|
||||
*/
|
||||
(function() {
|
||||
|
||||
var bodyEl = document.body,
|
||||
content = document.querySelector( '.content-wrap' ),
|
||||
openbtn = document.getElementById( 'open-button' ),
|
||||
closebtn = document.getElementById( 'close-button' ),
|
||||
isOpen = false;
|
||||
|
||||
function init() {
|
||||
initEvents();
|
||||
}
|
||||
|
||||
function initEvents() {
|
||||
openbtn.addEventListener( 'click', toggleMenu );
|
||||
if( closebtn ) {
|
||||
closebtn.addEventListener( 'click', toggleMenu );
|
||||
}
|
||||
|
||||
// close the menu element if the target it´s not the menu element or one of its descendants..
|
||||
content.addEventListener( 'click', function(ev) {
|
||||
var target = ev.target;
|
||||
if( isOpen && target !== openbtn ) {
|
||||
toggleMenu();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function toggleMenu() {
|
||||
if( isOpen ) {
|
||||
classie.remove( bodyEl, 'show-menu' );
|
||||
}
|
||||
else {
|
||||
classie.add( bodyEl, 'show-menu' );
|
||||
}
|
||||
isOpen = !isOpen;
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue