//下拉菜单 例调用:Nav('#nav'); function Nav(id){ var oNav = $(id); var aLi = oNav.find('li'); aLi.hover(function (){ $(this).addClass('on'); },function (){ $(this).removeClass('on'); }) }; //select表单友情链接 例调用:onChange="location1(this)"; //链接网站在新标签页打开 function location1(s) { var d = s.options[s.selectedIndex].value; window.open(d); s.selectedIndex=0; }; //链接网站在本页面打开 function location2(s) { var d = s.options[s.selectedIndex].value; s.selectedIndex=0; window.top.location.href = d; }; /*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 side_subMenu(){ $('.sub_left').find('.active').each(function(){ if($(this).parent().parent().hasClass('twoJ_menu')){ $(this).parent().parent().css('display','block'); $(this).parent().parent().parent().addClass('on') $(this).parent().parent().prev('.arrow').html('×') } }) $('.sub_left').find('.arrow').click(function(){ if($(this).parent().hasClass('on')){ $(this).parent().find('.twoJ_menu').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('.twoJ_menu').slideDown(); $(this).parent().siblings().find('.arrow').html('+'); $(this).html('一'); // $(this).addClass(一个使字体变大的class); // $(this).html('×'); }) // $('.twoJ_menu').css('display','block') } // 顶部搜索点击显示 $(function(){ $(document).bind("click",function(e){ if($(e.target).closest(".searchBtn").length == 0 && $(e.target).closest(".search").length == 0){ close(); }else{ open(); } }) }) function close(){ $('.searchBtn').show(); $('.search').hide(); } function open(){ $('.search').show(); }