menu-toggle sidebar
This commit is contained in:
parent
fb0ec22f42
commit
5939959969
3 changed files with 48 additions and 0 deletions
|
@ -36,8 +36,46 @@
|
|||
}
|
||||
};
|
||||
|
||||
var sideMenu = function(){
|
||||
var $menu = $('.tools').find('.toggle-menu');
|
||||
|
||||
|
||||
try{
|
||||
if($menu.length > 0){
|
||||
var $toggler = $menu.find('h6'),
|
||||
$submenu = $menu.find('nav > ul >li, nav > div');
|
||||
if($toggler.length > 0 && $submenu.length > 0){
|
||||
$toggler.addClass('closed');
|
||||
$toggler.wrapInner('<a href="#toggleMenu" class="toggler"></a>');
|
||||
$toggler.each(function( index ) {
|
||||
$(this).on( "click", function(e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
$this.toggleClass('closed');
|
||||
$this.toggleClass('opened');
|
||||
if($this.hasClass('opened')){
|
||||
var $foc = $this.closest('li.level1').find('li.level2:first-child').find('a:first-child');
|
||||
if($foc.length > 0){
|
||||
$foc.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//FIXME: store current nav state with local storage
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}catch(err){
|
||||
alert('err');
|
||||
}
|
||||
};
|
||||
|
||||
$(function(){
|
||||
mainMenu();
|
||||
sideMenu();
|
||||
});
|
||||
|
||||
} )( jQuery, spc );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue