/** * tabs * @return */ function tabs(tabtitle,tab_content,event){ var index=$(tabtitle).children(".hover").index() $(tab_content).children().eq(index).show().siblings().hide(); $(tabtitle).children().bind(event,function(){ var index=$(this).index(); $(this).addclass("hover").siblings().removeclass("hover"); $(tab_content).children().eq(index).show().siblings().hide(); return false; }); } function tabsurl(tabsurlclass){ var title1tab=$(tabsurlclass).find("dd") title1tab.hover(function(){ var url=$(this).find("a").attr("href") $(this).parent().siblings("div").find("a").attr("href",url) }) } /*选择框*/ function stoppropagation(event){ e=window.event||event; if(document.all){e.cancelbubble=true;}else{e.stoppropagation();e.stopimmediatepropagation();} } function select(demo){ $(demo).attr("val",0) $("body").on('click',demo,function(event){ var nowtext=$(this).find(".seljg").html().replace(/\s*/g,"") $(this).find(".seltj a").each(function(index, element) { var thishtml=$(this).html() if(thishtml===nowtext){$(this).addclass("hover").siblings().removeclass("hover")}}); var val=$(this).attr("val") if(val==0){$(this).find(".seltj").show().parents(demo).attr("val",1)}else{$(this).find(".seltj").hide().parents(demo).attr("val",0)} $(demo).not(this).attr("val",0) $(demo).not(this).find(".seltj").hide() //stoppropagation(event) return false; }) $("body").on("click",".seltj a",function(){ //$(".seltj a").click(function(){ var text=$(this).html() $(this).parents(demo).attr("val",0) $(this).parent().hide().siblings(".seljg").html(text).siblings("input").attr("value",text) //stoppropagation(event) return false; }) $(document).click(function(){ $(".seltj").hide() $(demo).attr("val",0) }) } function selectlink(demo){ $(demo).attr("val",0) $("body").on('click',demo,function(event){ var val=$(this).attr("val") console.log(val) if(val==0){ console.log($(this)) $(this).find(".seltj").show().parents(demo).attr("val",1); console.log("a") }else{ $(this).find(".seltj").hide().parents(demo).attr("val",0); console.log("b") } $(demo).not(this).attr("val",0) $(demo).not(this).find(".seltj").hide() stoppropagation(event) //return false; }) $(document).click(function(){ $(".seltj").hide() $(demo).attr("val",0) }) } /* *字体大小 */ $(function(){ var fontsize=$(".articletime span") var articlebox=$(".articlebox") fontsize.click(function(){ $(this).addclass("hover").siblings().removeclass("hover") var fonthtml=$(this).html(); if(fonthtml=="小") { articlebox.css({"font-size":"12px"}) } else if((fonthtml=="中")) { articlebox.css({"font-size":"14px"}) } else if((fonthtml=="大")) { articlebox.css({"font-size":"18px"}) } }) }) function banheight(){ var w_width=$(window).height();//窗口的高度 var d_dh=$(".topbox").height();//得到导航栏的高度 $(".indexbanner").height(w_width-d_dh)//计算出indexbanner图的高 } $(document).ready(function(){ //导航效果 //一级导航 $(".menu dd").hover(function(){ //鼠标移入效果 $(".menu dd.hover").addclass("active").removeclass("hover"); $(this).addclass("hover"); $(this).find(".ejmenu").stop(true,true).slidedown(); },function(){ //鼠标移开 $(this).removeclass("hover"); $(".menu dd.active").addclass("hover").removeclass("active"); $(this).find(".ejmenu").stop(true,true).slideup(); }) //二级导航 $(".ejmenulist .ejmenu-li").hover(function(){ //鼠标移入二级 $(this).find(".sjmenubox").stop(true,true).show(); },function(){ $(this).find(".sjmenubox").stop(true,true).hide(); }) //判断是否有三级 $(".sjmenu").each(function(index, element) { if($(this).find("li").length>0){ $(this).parent().siblings(".ejmenu-title").find("i").show() } }); /*banner图效果*/ $('.indexbanner').slick({ infinite: true, dots:true, autoplay: true, autoplayspeed: 5000, speed:1000, fade: true, draggable:false, pauseonfocus:false, pauseondotshover:false, pauseonhover:false }); banheight() //招聘 $(".recruitcn dd").each(function(index, element) { $(this).find(".jointit").click(function(){ if($(this).hasclass("active")){ $(this).removeclass("active"); $(this).siblings(".joindeta").slideup(); }else { $(this).addclass("active"); $(this).siblings(".joindeta").slidedown(); $(this).parent("dd").siblings().find(".joindeta").hide(); $(this).parent("dd").siblings().find(".jointit").removeclass("active") } }) }); /*二级导航*/ $(".loclist .myslide").hover(function(){ //鼠标移入效果 $(".loclist .myslide.hover").addclass("active").removeclass("hover"); $(this).addclass("hover"); },function(){ //鼠标移开 $(this).removeclass("hover"); $(".loclist .myslide.active").addclass("hover").removeclass("active"); }) //下拉选择框 selectlink(".msg_form_sel"); $(".footerbotrlist li:last-child").addclass("hide") /*联动效果*/ $('.newsimg').on('init', function(event, slick){ }); $('.newsimg').on('afterchange', function(event, slick){ $(".newspage span").text('0'+(slick.currentslide+1)); }); $('.newsimg').slick({ dots: true, asnavfor: '.newstxt', appenddots:$(".nigbgdot") }); $('.newstxt').slick({ asnavfor: '.newsimg', arrow:false, autoplay:true }); function newsprev(){ $('.newsimg').slick('slickprev'); } function newsnext(){ $('.newsimg').slick('slicknext'); } /*联动效果*/ $('.imglist1').on('init', function(event, slick){ }); $('.imglist1').on('afterchange', function(event, slick){ $(".newspage span").text('0'+(slick.currentslide+1)); }); $('.imglist1').slick({ dots: true, asnavfor: '.imgtxt', appenddots:$(".nigbgdot") }); $('.imgtxt').slick({ asnavfor: '.imglist1', arrow:false, autoplay:true }); function newsprev(){ $('.imglist1').slick('slickprev'); } function newsnext(){ $('.imglist1').slick('slicknext'); } }); $(window).resize(function(){ banheight(); });