$(function(){ $("a").focus(function(){this.blur();}); $(".mainnav li").each(function (i, n) { if ($(this).find(".navpull dd").length == 0) { $(this).find(".arr").hide(); $(this).find(".navpull").addclass("null"); } }); //搜索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").toggleclass("on"); $("body").toggleclass("bodyon"); $(".closebtn").slidetoggle(0); }); // $(".closebtn").click(function(){ $(".openbtn").removeclass("on"); $(".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) { $(".header").removeclass("fixed3"); $(".header").addclass("fixed2"); return; } p = $(this).scrolltop(); if (t < p) {//下滚 $(".header").removeclass("fixed2").addclass("fixed3"); } else if(t>p) {//上滚 $(".header").removeclass("fixed3").addclass("fixed2"); } t = p; }); }); // if($(window).width()>998){ $(".mainnav li").hover(function(){ $(this).find(".navpull").stop(true,true).delay(100).slidedown(); },function(){ $(this).find(".navpull").stop(true,true).delay(100).slideup(); }); //pc端下拉 }else{ $(".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"); } }); }); //sj端下拉 $(".singlepage img").removeattr("width").removeattr("height"); $(".homefwly .item").eq(0).removeclass('on'); } $(".tabnav li").eq(0).addclass("on"); $('.tabslide').each(function () { var _this = $(this); _this.find(".con:first").removeclass("nones").addclass("animated fadein"); _this.find(".tabnav li").on("mouseover", function () { var num = $(this).index(); $(this).addclass("on"); $(this).siblings().removeclass("on"); _this.find(".con").addclass("nones").removeclass("animated fadein"); _this.find(".con").eq(num).removeclass("nones").addclass("animated fadein"); }); }); //切换 $(".itemhover").hover(function(){ $(this).addclass("activehover"); },function(){ $(this).removeclass("activehover"); }); $(".itemhover2").hover(function(){ $(this).addclass("activehover2"); },function(){ $(this).removeclass("activehover2"); }); //滑过显示阴影效果 $(".footer .link li").each(function(){ $(this).hover(function(){ $(this).find(".select").stop(true,true).toggleclass("on"); }) }) //底部友情链接 $(window).scroll(function () { var hi = $(window).scrolltop(); if($('.rightcon').length && hi>$('.rightcon').offset().top-90){ $('.fixmenu').addclass('fix'); } else{ $('.fixmenu').removeclass('fix'); } }); //吸顶 $(".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 } }); }); //弹出放大图层 $(".prevnextbox dl").each(function() { var myhref = $(this).find("a").attr("href"); if (myhref == "#") { $(this).find("a").addclass("none"); $(this).find("a").removeattr("href"); } }); //新闻详情 $(".singlepage img").parent("p span").css("text-indent","0em"); $(".singlepage img").parent("p").css("text-indent","0em"); // $(".itemlist").each(function(){ var _this=$(this) var _li=_this.find("li") if(_li.length <= 4){ _this.find(".more").hide(); } _this.find("li").eq(0).show(); _this.find("li").eq(1).show(); _this.find("li").eq(2).show(); _this.find("li").eq(3).show(); var length1=_li.length; var u=4; var s=4; _this.find(".more").click(function(){ if((u+s) offset ) ? $back_to_top.addclass('cd-is-visible') : $back_to_top.removeclass('cd-is-visible'); }); $('.totop').click(function(){$('html,body').animate({scrolltop: '0px'}, 800);}); //返回顶部 });