var is_moblie,SLIDE,NAVFIXED,CATID,SUBFIXED,ONCONTEXT,ONCOPY,ONSELECT; $(function () { //==========导航 $(".nav ul li").hover(function() { $(this).addClass("on"); $(this).children('a.cn').stop().animate({ "margin-top" : -32 + 'px' }, 300) }, function() { $(this).removeClass("on"); $(this).children('a.cn').stop().animate({ "margin-top" : 0 }, 300) }); //==========搜索 $(".submit").mouseover( function () { $(this).css({"margin-left":10+'px'}); $(".keyword").animate({ "width" : 330+'px' }, 300).show().focus(); }); $(".submit").on("click", function () { var val = $(".keyword").val(); if ( $.trim(val) == "" ) { $(".keyword").focus(); return false; } return true; }) //==========外链 $(".wl ul li").hover(function() { $(this).children('a.show-pic').stop().animate({ "margin-top" : -38 + 'px' }, 300) }, function() { $(this).children('a.show-pic').stop().animate({ "margin-top" : 0 }, 300) }); //==========特效(上移) if (is_moblie != 1 && SLIDE != 1) { if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ new WOW().init(); }; } //==========首页悬浮 if ($.trim(CATID) == '' && NAVFIXED != 1){ $(document).scroll( function () { navt = $(".header").offset().top, has = $(".comm-header").hasClass("hscroll");//正常模式下的下拉导航 t = $(document).scrollTop(); if (t >= navt && t !=0) { if (has){ $(".comm-header.hscroll").addClass("fie"); } else { $("#header").addClass("fixed"); } } else { if (has){ $(".comm-header.hscroll").removeClass("fie"); } else{ $("#header").removeClass("fixed"); } } }); } else if(NAVFIXED != 1 && SUBFIXED == 1) { $(document).scroll( function () { navt = $(".header").offset().top, has = $(".comm-header").hasClass("hscroll");//正常模式下的下拉导航 t = $(document).scrollTop(); if (t >= navt && t !=0) { if (has){ $(".comm-header.hscroll").addClass("fie"); } else { $("#header").addClass("fixed"); } } else { if (has){ $(".comm-header.hscroll").removeClass("fie"); } else{ $("#header").removeClass("fixed"); } } }); } //======内容页子菜单悬浮 if ($.trim(CATID) != '' && SUBFIXED != 1) { if ($('.subcate')[0]) { // 子菜单浮动 $(window).load(function() { var scrollObj = $('.subcate'); var offsetLeft = scrollObj.offset().left, objOffsetTop = scrollObj.offset().top, objHeight = scrollObj.height(); $(window).scroll(function(e){ var scrollTop = $(document).scrollTop(); if (scrollTop >= objOffsetTop) { scrollObj.addClass('n-fixed'); } else { scrollObj.removeClass('n-fixed'); } }); }); } } //======返回顶部 $("#get_top").on("click",function () { $("body,html").animate({ scrollTop : 0 }, 1000); }); //禁止右键 if (ONCONTEXT) { document.oncontextmenu = function (event){ if(window.event){ event = window.event; }try{ var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){ return false; } return true; }catch (e){ return false; } } } //屏蔽复制 if (ONCOPY) { document.oncopy = function (event){ if(window.event){ event = window.event; }try{ var the = event.srcElement; if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){ return false; } return true; }catch (e){ return false; } } } //屏蔽选中 if (ONSELECT) { document.onselectstart = function (event){ if(window.event){ event = window.event; }try{ var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){ return false; } return true; } catch (e) { return false; } } } })