/*全局自适应高度*/ function autoFlashHeight(){ var headerHeight = $(".header").height(); var toolsbarHeight = $(".toolsbar").height(); var ftoolsbarHeight = $(".toolsbar-f").height(); var bottomContentHeight = $(".bottom-content").height(); var toolsBarHeightQ = $(".tools-bar-height-q").height(); var toolsBarHeightD = $(".tools-bar-height-d").height(); $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-202); $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-202); $(".main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1); $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1); $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37); $(".main-data-not").height($(window).height()-headerHeight-1); $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64); $(".side-content").height($(window).height()-headerHeight ); $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight); $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight); $(".form-list").height($(window).height()-headerHeight-50 ); }; $(window).resize(autoFlashHeight); /*全局自适应高度结束*/ $(function(){ /*侧滑*/ $(".open-sidebar").click(function(){ $(".slide-sidebar").animate({width:"800"}).addClass("open"); }); $("body").click(function(event){ var e = event || window.event; //浏览器兼容性 if(!$(event.target).is('a')) { var elem = event.target || e.srcElement; while (elem) { //循环判断至跟节点,防止点击的是div子元素 if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') { return false; } elem = elem.parentNode; } $(".slide-sidebar").animate({width:"0"}).removeClass("open")// 关闭处理 } }); /*侧滑*/ /*工具提示*/ $(function () { $('[data-toggle="tooltip"]').tooltip() }); /*侧栏菜单*/ $(".bg-nav > li > a").click(function() { var self = $(this); var subMenu = $(this).siblings('ul.sub-menu'); if(subMenu.length > 0) { if(subMenu.is(":visible")) { self.find('.menu-arrow').removeClass('fa-angle-up').addClass('fa-angle-down'); subMenu.slideUp('fast'); self.parent().removeClass('active'); }else{ self.parent().addClass('active'); self.find('.menu-arrow').removeClass('fa-angle-down').addClass('fa-angle-up'); subMenu.slideDown('fast'); } } }); // 数据提交 $("#submit-form").click(function() { $("#save-form").submit(); }); }); /** * 提示框 * * @param string message * @param string type * @param string icon * @return void */ function toast(message, type, icon) { var toast = $(".toast"); toast.addClass(type); toast.children('.message').html(message); var iconClass = 'fa-' + icon; toast.children('.icon').addClass(iconClass); toast.fadeIn(500); setTimeout(function() { toast.fadeOut('fast'); toast.children('.message').text(''); toast.children('.icon').removeClass(iconClass); }, 3000); }