$(window).load(function () { console.log('debugger.............'); var $aside = $("#wp-navi-aside"); var navDom = $($("#nav").find(".wp-menu")[0]).clone(); $(".navi-aside-wrap", $aside).append(navDom); $(".navi-aside-toggle").click(function () { $aside.addClass('wp-navi-aside-active'); $("html").css({ marginTop: 0, overflow: 'hidden' }); $("body").addClass('navi-aside-page').css({ width: $(window).width(), height: $(window).height() }) .stop().animate({ marginLeft: 216 }, 250); $(".aside-inner", $aside).addClass('aside-inner-show').stop().animate({ left: 0 }, 250); }); $(".navi-aside-mask").on("click", function (event) { event.preventDefault(); $("body").removeClass('navi-aside-page').stop().animate({ marginLeft: 0 }, 250, function () { $("body").removeAttr('style'); $aside.removeClass('wp-navi-aside-active'); $("html").removeAttr('style'); }); $(".aside-inner", $aside).removeClass('aside-inner-show').stop().animate({ left: -216 }, 250); }); $(".menu-switch-arrow", ".wp-navi-aside").prev().on("click", function () { $(this).toggleClass('menu-open-arrow').siblings(".sub-menu").slideToggle(250); }); $(".menu-switch-arrow", ".wp-navi-aside").on("click", function (e) { e.preventDefault(); $(this).toggleClass('menu-open-arrow').parent().siblings(".sub-menu").slideToggle(250); }); });