kompose/docs/assets/js/menu-2.js
Charlie Drage 597e7b0fdc
Add new kompose site (#1475)
Adds the new kompose site and moves it to the /docs folder so that it's
compatible with old links as well as gh-pages
2022-01-13 14:05:38 -05:00

38 lines
1.5 KiB
JavaScript

jQuery(document).ready(function($){
var $lateral_menu_trigger = $('.nav-trigger'),
$content_wrapper = $('.main');
//open-close lateral menu clicking on the menu icon
$lateral_menu_trigger.on('click', function(event){
event.preventDefault();
$lateral_menu_trigger.toggleClass('is-open');
$content_wrapper.toggleClass('is-open').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
// firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden
$('body').toggleClass('overflow-hidden');
});
$('.menu-inner').toggleClass('is-open');
//check if transitions are not supported - i.e. in IE9
if($('html').hasClass('no-csstransitions')) {
$('body').toggleClass('overflow-hidden');
}
});
//close lateral menu clicking outside the menu itself
$content_wrapper.on('mouseover', function(event){
if( !$(event.target).is('.nav-trigger, .nav-trigger span') ) {
$lateral_menu_trigger.removeClass('is-open');
$content_wrapper.removeClass('is-open').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
$('body').removeClass('overflow-hidden');
});
$('.menu-inner').removeClass('is-open');
//check if transitions are not supported
if($('html').hasClass('no-csstransitions')) {
$('body').removeClass('overflow-hidden');
}
}
});
});