$(function() { $('.search input').bind('focus',function(){ $(this).parent().addclass("hover"); }); $('.search input').bind('blur',function(){ $(this).parent().removeclass("hover"); }); $('.input').bind('focus',function(){ $(this).addclass("hover"); }); $('.input').bind('blur',function(){ $(this).removeclass("hover"); }); $('.form input').bind('focus',function(){ if($(this).val()==""){ $(this).next("label").hide(); } }); $('.form input').bind('blur',function(){ if(!$(this).val()){ $(this).next("label").show(); } }); $(".weixin-code").hover(function(){ $(this).find("div").fadein(300); },function(){ $(this).find("div").fadeout(200); }) var timeout = -1; $(".nav li").each(function(){ $(this).hoverdelay({ hoverevent:function(){ $(this).parent().find('li').removeclass('hover'); $(this).addclass('hover'); var i=$(".nav li").index(this)-1; if(i>=0){ $('#sub-nav div:eq('+i+')').addclass('hover'); }; cleartimeout(timeout); }, outevent: function(){ $(this).removeclass('hover'); timeout=settimeout(function(){ $('.nav .current').addclass('hover'); },200); var i=$(".nav li").index(this)-1; $('#sub-nav div:eq('+i+')').removeclass('hover'); } }); }) $('#sub-nav .sub-nav-item').each(function(){ $(this).hoverdelay({ hoverevent:function(){ $(this).addclass('hover'); var i=$("#sub-nav div").index(this)+1; $('.nav li').removeclass('hover'); $('.nav li:eq('+i+')').addclass('hover'); cleartimeout(timeout); }, outevent: function(){ $(this).removeclass('hover'); var i=$("#sub-nav div").index(this)+1; $('.nav li:eq('+i+')').removeclass('hover'); timeout=settimeout(function(){ $('.nav .current').addclass('hover'); },200); } }); }) $('#page-top .sub-cate a').hover(function(){ $(this).parent().find('a').removeclass('hover'); $(this).addclass('hover'); cleartimeout(timeout); },function(){ if(!$(this).hasclass("current")){ $(this).removeclass('hover'); var timeout=settimeout(function(){ $('#page-top .sub-cate a.current').addclass('hover'); },200); } }) jquery(".news-slider").slide({titcell:".hd li",maincell:".bd ul",effect:"leftloop",trigger:"click",autoplay:true,delaytime:700,intertime:6000,easing:"easeinoutexpo"}); jquery('.chanye-slider ul').bxslider({ minslides: 5, maxslides: 5, slidewidth: 200, slidemargin: 25, moveslides:1, auto:true, pause:6000 }); jquery('.index-pro-slider ul').bxslider({ mode:"vertical", slidemargin:5, auto:true, pause:6000 }); $("#pro-next").click(function(){ $(".index-pro .bx-next").trigger("click"); }) $("a.tabs").click(function () { $(this).parent().find("a.current").removeclass("current"); $(this).addclass("current"); for(var i=0;i<$(this).parent().find("a").length;i++){ $("#"+$(this).parent().find("a:eq("+i+")").attr("rel")).hide(); } $("#"+$(this).attr("rel")).show(); return false; }); $("a.tab").hover(function () { $(this).parent().find("a.current").removeclass("current"); $(this).addclass("current"); for(var i=0;i<$(this).parent().find("a").length;i++){ $("#"+$(this).parent().find("a:eq("+i+")").attr("rel")).hide(); } $("#"+$(this).attr("rel")).show(); return false; }); var win = $(window); (function() { var banner = $('#banner'), pic_c = banner.find('.pics'), pics = pic_c.children(), idx_c = banner.find('.idxs'), idxs = idx_c.children(), btns = banner.find('.btns a'), prev = btns.filter('.prev'), next = btns.filter('.next'), len = pics.length, idx = 0, prev_i = -1, max_i = len - 1, curr_p = pics.eq(idx), curr_i = idxs.eq(idx), delay = 5000, timeout = -1; win.on('load', function() { idx_recu(0, 1500/len, function() { settimeout(function() { curr_i.addclass('on'); auto(); }, 300); idxs.click(hover); }); banner.hover(function() { // prev.stop().fadein(300); // next.stop().fadein(300); btns.addclass('on'); }, function() { btns.removeclass('on'); // prev.stop().fadeout(300); // next.stop().fadeout(300); }); prev.on('click', function() {fade(idx===0? idx=max_i:--idx)}); next.on('click', function() {fade(idx===max_i? idx=0:++idx)}); }); function fade(idx) { cleartimeout(timeout); prev_i = idx; curr_p.stop(false,true).fadeout(300); curr_p = pics.eq(idx).stop(false,true).fadein(300); curr_i.removeclass('on'); curr_i = idxs.eq(idx).addclass('on'); auto(); } function hover(){ idx = $(this).index(); if (idx === prev_i) return; fade(idx); } function idx_recu(idx, delay, func) { temp = idxs.eq(idx); if (temp.length) { temp.css('margin-top',0).fadein(500); settimeout(function() { idx_recu(idx+1, delay, func); }, delay); } else { func(); return; } } function auto() { timeout = settimeout(function() { fade(idx===max_i? idx=0: ++idx); }, delay); } }()); }); /* var tur = true; function haha(){ t = $(document).scrolltop(); if(t > 175){ $('#header .mask').animate({height: '60px',opacity:1}, 300); $('#header .logo').animate({height: '50px',top: '5px'}, 300); $('#header .top-link').animate({top: '-35px'}, 300); $('#header .nav').animate({top: '25px'}, 300); if(t<$("body").height()-$(window).height()-130){ $('#follow-btn').fadein(300); $('#follow-btn').css("bottom","2px"); }else{ $('#follow-btn').fadein(300); $('#follow-btn').css("bottom","132px"); } }else{ $('#header .mask').animate({height: '85px',opacity:0.7}, 300); $('#header .logo').animate({height: '63px',top: '12px'}, 300); $('#header .top-link').animate({top: '10px'}, 300); $('#header .nav').animate({top: '50px'}, 300); $('#follow-btn').fadeout(300); $('#follow-btn').css("bottom","-106px"); } tur = true; } window.onscroll = function(){ if(tur){ settimeout(haha,500); tur = false; }else{ } } */