46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
var LeftMenu = new function() {
|
|
|
|
this.initMenu = function(){
|
|
$('#side-menu').metisMenu();
|
|
|
|
$(window).bind("load resize", function() {
|
|
topOffset = 50;
|
|
width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
|
|
if (width < 768) {
|
|
$('div.navbar-collapse').addClass('collapse')
|
|
topOffset = 100; // 2-row-menu
|
|
}
|
|
else
|
|
$('div.navbar-collapse').removeClass('collapse')
|
|
height = (this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height;
|
|
height = height - topOffset;
|
|
if (height < 1)
|
|
height = 1;
|
|
if (height > topOffset)
|
|
$("#page-wrapper").css("min-height", (height) + "px");
|
|
});
|
|
}//initMenu
|
|
|
|
this.toggleMenu = function(){
|
|
var check = $(".sidebar").css("left");
|
|
if ( check == "auto" || check =="0px"){
|
|
$(".sidebar").css({"left":'220px'})
|
|
//$(".sidelist").addClass("pull-right");
|
|
//사이트 메뉴 add -> remove
|
|
$("#page-wrapper").addClass("page-wrapper_add");
|
|
$(".text_ch").html("메뉴닫기");
|
|
}
|
|
else {
|
|
$(".sidebar").css({'left':'auto'});
|
|
//사이트 메뉴 add -> remove
|
|
$("#page-wrapper").removeClass("page-wrapper_add")
|
|
//$(".sidelist").removeClass("pull-right");
|
|
$(".text_ch").html("메뉴열기");
|
|
}
|
|
}//toggleMenu
|
|
}//LeftMenu
|
|
|
|
$(window).load(function(){
|
|
LeftMenu.initMenu();
|
|
$(document).on("click",".menu_button",LeftMenu.toggleMenu);
|
|
}); |