$("[data-menu]").on("click",function(){$(".menu").removeClass("active-menu-box-topactive-menu-box-bottomactive-menu-box-modalactive-menu-fullactive-sidebar-left-overactive-sidebar-left-pushactive-sidebar-right-pushactive-sidebar-left-parallaxactive-sidebar-right-parallaxactive-sidebar-right-over"),$(".page-content,.header").removeClass("active-body-left-pushactive-body-right-pushactive-body-left-parallaxactive-body-right-parallax"),$(".menu").css({"margin-top":""}),$(".menu-hider").addClass("active-menu-hider");vare=$(this).data("menu-type"),t=$(this).data("menu"),a=$("#"+t).data("menu-height"),o=$("#"+t).data("menu-height")/6;return"menu-full-bottom"===e&&($("#"+t).toggleClass("active-menu-full-bottom"),$("#"+t).hasClass("active-menu-full-bottom")||$(".menu-hider").removeClass("active-menu-hider")),"menu-full-top"===e&&($("#"+t).toggleClass("active-menu-full-top"),$("#"+t).hasClass("active-menu-full-top")||$(".menu-hider").removeClass("active-menu-hider")),"menu-box-modal"===e&&($("#"+t).css({height:a}),$("#"+t).css({"margin-top":a/2*-1}),$("#"+t).toggleClass("active-menu-box-modal")),"menu-box-full"===e&&$("#"+t).toggleClass("active-menu-box-full"),"menu-box-bottom"===e&&($("#"+t).toggleClass("active-menu-box-bottom"),$(".page-content").css("transform","translateY("+-1*o+"px)"),$(".header").css("transform","translateY(-90px)")),"menu-box-top"===e&&($("#"+t).toggleClass("active-menu-box-top"),$(".page-content").css("transform","translateY("+o+"px)"),$(".header").css("transform","translateY(-90px)")),"menu-sidebar-left-over"===e&&$("#"+t).toggleClass("active-sidebar-left-over").addClass("menu-sidebar-shadow"),"menu-sidebar-left-push"===e&&($("#"+t).toggleClass("active-sidebar-left-push"),$(".page-content,.header").toggleClass("active-body-left-push")),"menu-sidebar-left-parallax"===e&&($("#"+t).toggleClass("active-sidebar-left-parallax").addClass("menu-sidebar-shadow"),$(".page-content,.header").toggleClass("active-body-left-parallax")),"menu-sidebar-right-parallax"===e&&($("#"+t).toggleClass("active-sidebar-right-parallax").addClass("menu-sidebar-shadow"),$(".page-content,.header").toggleClass("active-body-right-parallax")),"menu-sidebar-right-over"===e&&$("#"+t).toggleClass("active-sidebar-right-over").addClass("menu-sidebar-shadow"),"menu-sidebar-right-push"===e&&($("#"+t).toggleClass("active-sidebar-right-push"),$(".page-content,.header").toggleClass("active-body-right-push")),!1})return那里返回结果怎么一大串,很多都用“,”连起来,这里不太懂,为啥这么写?还有一点,return"menu-full-bottom"===e&&($("#"+t).toggleClass("active-menu-full-bottom"),有个逻辑&&运算符,怎么这么写呢,为啥来个&&意义在何处啊?这种写法看得我头疼。可不可以这样写?return"menu-full-bottom"===e&&($("#"+t).toggleClass("active-menu-full-bottom"),$("#"+t).hasClass("active-menu-full-bottom")||$(".menu-hider").removeClass("active-menu-hider")),"menu-full-top"===e&&($("#"+t).toggleClass("active-menu-full-top"),$("#"+t).hasClass("active-menu-full-top")||$(".menu-hider").removeClass("active-menu-hider")),"menu-box-modal"===e&&($("#"+t).css({height:a}),$("#"+t).css({"margin-top":a/2*-1}),$("#"+t).toggleClass("active-menu-box-modal")),"menu-box-full"===e&&$("#"+t).toggleClass("active-menu-box-full"),"menu-box-bottom"===e&&($("#"+t).toggleClass("active-menu-box-bottom"),$(".page-content").css("transform","translateY("+-1*o+"px)"),$(".header").css("transform","translateY(-90px)")),"menu-box-top"===e&&($("#"+t).toggleClass("active-menu-box-top"),$(".page-content").css("transform","translateY("+o+"px)"),$(".header").css("transform","translateY(-90px)")),"menu-sidebar-left-over"===e&&$("#"+t).toggleClass("active-sidebar-left-over").addClass("menu-sidebar-shadow"),"menu-sidebar-left-push"===e&&($("#"+t).toggleClass("active-sidebar-left-push"),$(".page-content,.header").toggleClass("active-body-left-push")),"menu-sidebar-left-parallax"===e&&($("#"+t).toggleClass("active-sidebar-left-parallax").addClass("menu-sidebar-shadow"),$(".page-content,.header").toggleClass("active-body-left-parallax")),"menu-sidebar-right-parallax"===e&&($("#"+t).toggleClass("active-sidebar-right-parallax").addClass("menu-sidebar-shadow"),$(".page-content,.header").toggleClass("active-body-right-parallax")),"menu-sidebar-right-over"===e&&$("#"+t).toggleClass("active-sidebar-right-over").addClass("menu-sidebar-shadow"),"menu-sidebar-right-push"===e&&($("#"+t).toggleClass("active-sidebar-right-push"),$(".page-content,.header").toggleClass("active-body-right-push")),!1一个,一行,这样写可以嘛?不然看得我更懵b了。
慕运维8079593
陪伴而非守候
相关分类