This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/webapp/static/pages/scripts/home.js
2018-02-06 21:39:59 +08:00

74 lines
1.5 KiB
JavaScript

var home = function () {
var decorator_init = function() {
//解决sitemesh3中body属性无法加载问题
if($("#metaId")[0] && $("#metaId").val() != "")
$("body").attr("id",$("#metaId").val());
if($("#metaClass")[0] && $("#metaClass").val() != "")
$("body").attr("class",$("#metaClass").val());
}
//菜单选择触发事件
var menu_action_init = function() {
//顶部导航顶级菜单事件
$(".mega-menu li a").click(function(e){
var $this = $(this);
var next_ul = $this.next("ul");
var prev_ul = $this.parents("ul");
var menuId = "#menu_" + $this.attr("id");
if(next_ul.length) {
return false;
}
if(prev_ul.hasClass("dropdown-menu")) {
$this = prev_ul;
}
$(".mega-menu li.active").removeClass("active")
$this.parent("li").addClass("active");
if ($(menuId).length){
$(".page-sidebar>.accordion").addClass("hide");
$(menuId).removeClass("hide");
}
})
}
return {
init: function () {
decorator_init();
menu_action_init();
},
setIframeHeight: function (iframe) {
if (iframe) {
var iframeWin = iframe.contentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.body.clientHeight;
}
}
}
};
}();
jQuery(document).ready(function() {
home.init();
});