$(function(){ $("a").focus(function(){this.blur();}); settimeout(function(){ $(".header").animate({"top":"0px"},1000); },20); //搜索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(); $(".mainnav").toggleclass("on"); $("body").toggleclass("bodyon"); $(".closebtn").slidetoggle(0); }); // $(".closebtn").click(function(){ $(".openbtn").removeclass("on"); $(".mainnav").slidetoggle(); $(".mainnav").toggleclass("on"); $("body").removeclass("bodyon"); $(".closebtn").slidetoggle(0); }); // $(".mainnav li").each(function (i, n) { if ($(this).find(".navpull dd").length == 0) { $(this).find(".navpull").addclass("null"); $(this).find(".arr").hide(); } }); $(window).scroll(function() { if($(window).scrolltop()>=90){ $(".header").addclass("on"); }else{ $(".header").removeclass("on"); } }); // 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; }); }); $(".footer .link").hover(function(){ $(this).find("dd").toggleclass("on"); $(".footer .link").toggleclass("on"); }); if($(window).width()>1024){ $(".mainnav li").hover(function(){ $(this).find(".navpull").stop(true,true).slidedown(); },function(){ $(this).find(".navpull").stop(true,true).slideup(); }); //pc端下拉 }else{ } if($(window).width()<1024){ $(".mainnav li").each(function(){ var btn = $(this).find(".arr"); btn.click(function(){ var statis = $(this).parents("li").find(".navpull").css("display"); if(statis == "none"){ $(this).parents("li").siblings().removeclass("onnav"); $(this).parents("li").siblings().find(".navpull").slideup(); $(this).parents("li").addclass("onnav"); $(this).parents("li").find(".navpull").slidedown(); } else{ $(this).parents("li").find(".navpull").slideup(); $(this).parents("li").removeclass("onnav"); } }); }); // }else{ } //sj端下拉 $(".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 } }); }); //弹出放大图层 $(".iteminfo").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; } } }); // });