$(function(){ $("a").focus(function(){this.blur();}); //搜索s $(".header .searchico").click(function() { $(".header .searchbox").toggleclass("on"); $(this).toggleclass("on"); $(".mainnav").removeclass("on"); $(".closebtn").fadeout("on"); $(".openbtn").removeclass("on"); }); //搜索end $(".openbtn").click(function(){ $(this).toggleclass("on"); $(".mainnav").slidetoggle(0); $(".navpullbg").slidetoggle(); $(".mainnav").toggleclass("on"); $("body").toggleclass("bodyon"); $(".closebtn").slidetoggle(0); }); // $(".closebtn").click(function(){ $(".openbtn").removeclass("on"); $(".mainnav").slidetoggle(0); $(".navpullbg").slidetoggle(); $(".mainnav").toggleclass("on"); $("body").removeclass("bodyon"); $(".closebtn").slidetoggle(0); }); // var p = 0, t = 0; $(function () { var prevscrtop = 0; $(document).scroll(function () { var scrtop = $(document).scrolltop(); var topbarheight = $(".container").height(); var menubarheight = $(".header").height(); var level1max = topbarheight; var level2max = menubarheight + topbarheight; if (scrtop > level2max) { //$(".header").addclass("fixed3"); } if (scrtop == 0) { $(".header").removeclass("fixed3").removeclass("fixed2"); return; } if (scrtop < level2max) { console.log(3); $(".header").removeclass("fixed3"); $(".header").addclass("fixed2"); return; } p = $(this).scrolltop(); if (t < p) {//下滚 $(".header").removeclass("fixed2").addclass("fixed3"); console.log("t:"+t+"p:"+p); } else if(t>p) {//上滚 $(".header").removeclass("fixed3").addclass("fixed2"); console.log(2); } t = p; }); }); if($(window).width()>1024){ $(".mainnav li.nava").hover(function(){ $(".navpullbg").stop(true,true).fadein(); $(".navpullbg").on("mouseover",function(){ $(this).show(); }); $(".navpullbg").on("mouseout",function(){ $(this).hide(); }); }); $(document).bind('mouseover',function(e){ var e = e || window.event; //浏览器兼容性 var elem = e.target || e.srcelement; while (elem) { //循环判断至跟节点,防止点击的是div子元素 if (elem.id && elem.id=='menuall') { return; } elem = elem.parentnode; } $('#menu').css('display','none'); //点击的不是div或其子元素 }); // $(".navpullbg .navpull").eq(0).show(); $(".mainnav .nava").hover(function(){ $(this).toggleclass("onnav"); var num = $(this).index(); $(".navpullbg .navpull").eq(num-1).stop(true,true).fadein().siblings(".navpullbg .navpull").hide(); }) //pc端下拉 }else{ $(".mainnav li").each(function(){ var btn = $(this).find(".arr"); btn.click(function(){ var statis = $(this).parents("li").find(".navpulls").css("display"); if(statis == "none"){ $(this).parents("li").siblings().removeclass("onnav"); $(this).parents("li").siblings().find(".navpulls").slideup(); $(this).parents("li").addclass("onnav"); $(this).parents("li").find(".navpulls").slidedown(); } else{ $(this).parents("li").find(".navpulls").slideup(); $(this).parents("li").removeclass("onnav"); } }); }); //手机端下拉 } $(".footer .share a").hover(function(){ $(this).toggleclass("on"); }) $(".footer .item").each(function(){ var btn = $(this).find(".arr"); btn.click(function(){ var statis = $(this).parents(".item").find(".sub").css("display"); if(statis == "none"){ $(this).parents(".item").siblings().removeclass("on"); $(this).parents(".item").siblings().find(".sub").slideup(); $(this).parents(".item").addclass("on"); $(this).parents(".item").find(".sub").slidedown(); } else{ $(this).parents(".item").find(".sub").slideup(); $(this).parents(".item").removeclass("on"); } }); }); //底部栏目 $(".itemhover").hover(function(){ $(this).addclass("activehover"); },function(){ $(this).removeclass("activehover"); }); //滑过显示阴影效果 $(".submenu .columnname .arr").click(function(){ $(this).parent().parent().find("ul").slidetoggle(); $(this).parent().toggleclass("on"); }); //内页二级 $('.gallery').each(function() { // the containers for all your galleries $(this).magnificpopup({ delegate: 'a', // the selector for gallery item type: 'image', gallery: { enabled:true } }); }); //弹出放大图层 $(".datalist .item").each(function(i,item){ if(number(i+1)%2 == 0){ $(this).addclass("next"); } }); // $(".prevnextbox dl").each(function() { var myhref = $(this).find("a").attr("href"); if (myhref == "#") { $(this).find("a").addclass("no"); $(this).find("a").removeattr("href"); } }); //新闻详情 $(".hrlist li").each(function(){ var btn = $(this).find(".jobtitle").find("table"); btn.click(function(){ var statis = $(this).parents("li").find(".txtcont").css("display"); if(statis == "none"){ $(this).parents("li").siblings().removeclass("current"); $(this).parents("li").siblings().find(".txtcont").slideup(500); $(this).parents("li").addclass("current"); $(this).parents("li").find(".txtcont").slidedown(500); } else{ $(this).parents("li").find(".txtcont").slideup(500); $(this).parents("li").removeclass("current"); } }); }); //人才招聘 $(".singlepage img").parent("p span").css("text-indent","0em"); $(".singlepage img").parent("p").css("text-indent","0em"); // var offset = 200, offset_opacity = 1200, scroll_top_duration = 1000, $back_to_top = $('.totop'); $(window).scroll(function(){ ( $(this).scrolltop() > offset ) ? $back_to_top.addclass('cd-is-visible') : $back_to_top.removeclass('cd-is-visible'); }); $('.totop').click(function(){$('html,body').animate({scrolltop: '0px'}, 800);}); //返回顶部 $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetoffset = $target.offset().top; $('html,body').animate({ scrolltop: targetoffset }, 1000); return false; } } }); // });