$(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(); } }); $(".right-slide-link").click(function(){ $("body").addClass("right-slide-on"); }) $(".right-slide .close-btn").click(function(){ $("body").removeClass("right-slide-on"); }) /* $(window).scroll(function () { w_height = $(window).height(); if (jQuery(window).scrollTop() < w_height-60 ) { jQuery('.page-banner .image').css('margin-top', $(window).scrollTop() / 2); } }); */ jQuery('.page-banner').addClass("hover"); var timeout = -1; $("#nav li.current").addClass('hover'); $("#nav li").hover(function(){ $(this).parent().find('li').removeClass('hover'); $(this).addClass('hover'); var i=$("#nav li").index(this)-1; if(i>=-1){ $('#sub-nav .sub-nav-item').removeClass("hover"); $('#sub-nav').addClass('hover'); if(i>=0){ $('#sub-nav div.sub-nav-item:eq('+i+')').addClass("hover"); }; } clearTimeout(timeout); }, function(){ $(this).removeClass('hover'); var i=$("#nav li").index(this)-1; $("#nav li.current").addClass('hover'); timeout=setTimeout(function(){ $('#sub-nav div.sub-nav-item:eq('+i+')').removeClass("hover"); $('#sub-nav').removeClass('hover'); },10); }) $('#sub-nav .sub-nav-item').hover(function(){ $('#sub-nav').addClass('hover'); var i=$("#sub-nav div.sub-nav-item").index(this)+1; $('#nav li').removeClass('hover'); $('#nav li:eq('+i+')').addClass('hover'); clearTimeout(timeout); },function(){ $('#sub-nav').removeClass('hover'); var i=$("#sub-nav div.sub-nav-item").index(this)+1; $('#nav li:eq('+i+')').removeClass('hover'); $("#nav li.current").addClass('hover'); timeout=setTimeout(function(){ $('#sub-nav div.sub-nav-item:eq('+i+')').removeClass("hover"); },10); }) $('#nav li').each(function(){ var i=$('#nav li').index(this); if(i>0){ $(".sub-nav-item").eq(i-1).find("ul").css("left",($(window).width()-1200)/2+(1200-$("#nav").width())+$(this).position().left); } }) jQuery(".news-slider").slide({titCell:".hd li",mainCell:".bd ul",effect:"leftLoop",trigger:"click",autoPlay:true,delayTime:700,interTime:6000,easing:"easeInOutExpo"}); $("a.tab").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.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; }); //新闻选项卡 $(document).ready(function () { function tab(i) { $(i).children().click(function () { //触发方式//click//mouseover $(this).siblings().removeClass(); $(this).addClass('current'); $(this).parent().siblings('.tab-box').hide(); $(this).parent().siblings('.tab-box').eq($(this).index()).show(); $('.tab-line').animate({ left: $(this).position().left-30}); }) } //tab调用 $(function () { tab('.tab1') }) }); 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 = 7000, 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); } }()); $("#follow-btn").css("right",($(window).width()-1200)/4-30+"px"); $(".back-top").click(function(){ $('html,body').animate({scrollTop: '0px'}, 400); return false; }) }); var tur = true; function haha(){ t = $(document).scrollTop(); if(t > 100){ $('#header').addClass("hover"); $('#sub-nav').addClass("hovers"); //$('#follow-btn .back-top').css("top","106px"); }else{ $('#header').removeClass("hover"); $('#sub-nav').removeClass("hovers"); //$('#follow-btn .back-top').css("top","500px"); } if(t > 200){ $('#follow-btn').css("bottom","120px"); }else{ $('#follow-btn').css("bottom","-200px"); } tur = true; } window.onscroll = function(){ if(tur){ setTimeout(haha,10); tur = false; }else{ } }