Nav('#nav')//导航 headerFix() SerMax()//搜索 mobideMenu()// 移动端主导航 Menu('.sub_mbtn','.sub_navm');//手机版导航 side_subMenu();//左侧边栏二级菜单 注意:如没有三级菜单请记得删除此方法 //搜索点击弹出效果 function SerMax(){ var searchTarget; $(".serBtn > i").click(function(e){ searchTarget=e.target; $(".ser").animate({width:"200px"}); $(this).hide(); }) $(".ser").click(function(e){ searchTarget=e.target; //搜索框搜索事件 }) $("html").click(function(event) { if (event.target !=searchTarget) { $(".ser").animate({width:"0"},300); //$(".ser").delay(300).hide(); $(".serBtn >i").show(); } }); } // 鼠标滑动导航置顶 function headerFix(){ var iWSon = document.documentElement.clientWidth; if(iWSon > 1024){ var $windowHeight = $(window).height(); var bodyHeight = $(document.body).height() var $headerHeight = $('.header').height()*2; $(window).scroll(function(){ var scrollTop = $(window).scrollTop(); if(scrollTop >= 89 && bodyHeight > $windowHeight+$headerHeight){ $('.header').addClass('current'); $('.logo .logo_bg').slideDown(300); if($('.header').hasClass('current')){ $('.headerFix-menu').fadeIn(300); $('.header.current .top').slideUp(300); $('.logo_01').find('image').attr({width:180,height:42}) $('.logo_01').find('svg').attr({width:180,height:42}) } }else{ $('.header').removeClass('current'); $('.logo .logo_bg').slideUp(300); if($('.header').hasClass('current')){ $('.headerFix-menu').fadeIn(300); }else{ $('.headerFix-menu,.headerFix-close').fadeOut(300); $('.header .top').slideDown(300) $('.logo_01').find('image').attr({width:220,height:49}) $('.logo_01').find('svg').attr({width:220,height:49}) } } }) } $('.headerFix-menu').click(function(){ $('.header.current .top').slideDown(300) $(this).fadeOut(100); $('.headerFix-close').fadeIn(300) }) $('.headerFix-close').click(function(){ $(this).fadeOut(300) $('.header.current .top').slideUp(300); $('.headerFix-menu').fadeIn(300) }) } //下拉菜单 例调用:Nav('#nav'); function Nav(id){ var oNav = $(id); var aLi = oNav.find('li'); aLi.hover(function (){ $(this).addClass('on'); $(this).find('.subNav').stop().slideDown(200); },function (){ $(this).removeClass('on'); $(this).find('.subNav').stop().slideUp(200); })}; //移动端主导航function mobideMenu(){ $(".mobile-inner-header .mobile-inner-header-icon").click(function(){ $(this).toggleClass("mobile-inner-header-icon-click mobile-inner-header-icon-out"); $('body').toggleClass('nav-open'); $('.black_bg01,.logo').slideToggle(200) }); $('.black_bg01').click(function(){ $(".mobile-inner-header .mobile-inner-header-icon").toggleClass("mobile-inner-header-icon-click mobile-inner-header-icon-out"); $('body').toggleClass('nav-open'); $(this).slideToggle(300) $('.logo').slideToggle(200) }) $(".mobile-inner-nav li > a").each(function( index ) { $( this ).css({'animation-delay': (index/20)+'s'}); }); $('.mobile-search-btn').click(function(){ $('.mobile_search').slideToggle(300) }) $('.mobile-inner-nav li strong').click(function(){ $(this).parent().toggleClass('on'); if($(this).parent().hasClass('on')){ $(this).addClass('icon-fanhui-copy ') $(this).removeClass('icon-fanhui') $(this).next('.mobile_subNav').slideDown(300) }else{ $(this).addClass('icon-fanhui') $(this).removeClass('icon-fanhui-copy'); $(this).next('.mobile_subNav').slideUp(300) } }) } //移动端顶部点击弹出下拉菜单 function Menu(menu,main){ $(menu).click(function(){ $(this).toggleClass("mobile-inner-header-icon-click mobile-inner-header-icon-out"); $(this).find('i').toggleClass('iconarrowDown iconarrowUp') $(".sub_navm").slideToggle(250); }); $('.sub_navm').find('.phone_arrow').click(function(){ $(this).next('dl').slideToggle(500); $(this).toggleClass('on'); if($(this).hasClass('on')){ $(this).html("×") }else{ $(this).html("+") } }) }; function side_subMenu(){ $('.sub_left').find('.arrow').click(function(){ if($(this).parent().hasClass('on')){ $(this).parent().find('dl').slideUp(); $(this).parent().removeClass('on'); $(this).html("+") return false; }; $(this).parent().siblings().removeClass('on'); $(this).parent().siblings().find('dl').slideUp(); $(this).parent().addClass('on'); $(this).parent().find('dl').slideDown(); $(this).html('×'); }) } // 二级页头部大图高度 function SubImgHeight(){ var iWSon = document.documentElement.clientWidth; var oSubbanner = document.getElementById('subbanner'); if(iWSon>=1920){ oSubbanner.style.height = 350+'px'; }else if(iWSon<1920){ oSubbanner.style.height = iWSon * (350/1920)+'px'; } window.onscroll = window.onresize = function (){ var iWSon = document.documentElement.clientWidth; if(iWSon>=1920){ oSubbanner.style.height = 350+'px'; }else if(iWSon<1920){ oSubbanner.style.height = iWSon * (350/1920)+'px'; } } } function FontSize2(Size,obj){ var iNum = 13; $(Size).find('.max').bind('click',function (){ iNum+=2; if(iNum>=24){ iNum = 24; } $(obj).css('font-size',iNum + 'px'); return iNum; }) $(Size).find('.mid').bind('click',function (){ iNum = 13; $(obj).css('font-size',iNum + 'px'); return iNum; }) $(Size).find('.min').bind('click',function (){ iNum-=2; if(iNum<=14){ iNum = 12; } $(obj).css('font-size',iNum + 'px'); return iNum; }) }; /*tab切换*/ ;(function($){ $.fn.extend({ tab: function (options){ var defaults = { //默认参数 ev : 'mouseover', //默认事件'mouseover','click' delay : 100, //延迟时间 auto : true, //是否自动切换 true,false speed : 2000, //自动切换间隔时间(毫秒) more : false //是否有more,false,true }; var options = $.extend(defaults, options); //用户设置参数覆盖默认参数 return this.each(function (){ var o = options; var obj = $(this); var oTil = obj.find('.til_tab'); var oBox = obj.find('.tabListBox'); var oMore = null; var iNum = 0; var iLen = oTil.length; //鼠标事件绑定 oTil.bind(o.ev , function (){ var _this = this; if(o.ev == 'mouseover' && o.delay){ _this.timer = setTimeout(function (){ change(_this); },o.delay); }else{ change(_this); }; }) oTil.bind('mouseout',function (){ var _this = this; clearTimeout(_this.timer); }); //自动切换效果 (function autoPlay(){ var timer2 = null; if(o.auto){ function play(){ iNum++; if(iNum >= iLen){ iNum =0; }; change(oTil.eq(iNum)); }; timer2 = setInterval(play,o.speed); obj.on('mouseover',function (){ clearInterval(timer2); }) obj.on('mouseout',function (){ timer2 = setInterval(play,o.speed); }) }; })(); function change(box){ iNum = $(box).index(); oTil.removeClass('on'); oBox.css('display','none'); if(o.more){ oMore = obj.find('.more_tab'); oMore.css('display','none'); oMore.eq(iNum).css('display','block'); }; oTil.eq(iNum).addClass('on'); oBox.eq(iNum).css('display','block'); } }); } }) })(jQuery); // function listSlide(){ // $('.list04').each(function(){ // var $this = $(this); // $this.find('h3').eq(0).addClass('on'); // $this.find('h3').eq(0).next('p').slideToggle(300) // $this.find('.arrow').hover(function(){ // $this.find('h3').eq(0).removeClass('on'); // $this.find('h3').eq(0).next('p').css('display','none') // $(this).parent().next('p').slideToggle(300); // $(this).parent().toggleClass('on') // }) // }) // } /*友情链接*/ function divSelect(){ $('.divSelect').each(function(){ var citeText = $(this).find('ul li').eq(0).text() $(this).find('cite').text(citeText); }) $('.divSelect').find('cite').click(function (event) { //取消事件冒泡 event.stopPropagation(); $(this).next('ul').slideToggle(300); $(this).parent().toggleClass('active'); return false; }); //点击空白处隐藏弹出层,下面为滑动消失效果和淡出消失效果。 $(document).click(function(event){ var _con = $('.divSelect'); // 设置目标区域 if(!_con.is(event.target) && _con.has(event.target).length === 0){ //$('#divTop').slideUp('slow'); //滑动消失 $('.divSelect').find('.linkList02').slideUp(300); //淡出消失 $('.divSelect').removeClass('active') } }); }