$(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"); }); $(".right-slide-link").click(function(){ $("body").addclass("right-slide-on"); }) $(".right-slide .close-btn").click(function(){ $("body").removeclass("right-slide-on"); }) //新闻选项卡 $(document).ready(function () { function tab(i) { $(i).children().mouseover(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,width:$(this).width()}); }) } //tab调用 $(function () { tab('.tab-nav'); }) }); $('.form input').bind('focus',function(){ if($(this).val()==""){ $(this).next("label").hide(); } }); $('.form input').bind('blur',function(){ if(!$(this).val()){ $(this).next("label").show(); } }); $(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; var nav = $(".nav ul"), loc = location.href, links = nav.find("a"), link = null, tag = 0, width = 0, left = 0, indicator = $("
  • "); if (tag === 0) { //init(links.eq(0)); } function init(link) { width = link.innerwidth(); left = link.offset().left - ($(window).width()-$(".wrapper").width())/2 -$(".wrapper").width()+$('.nav').width()+parseint($('.nav').css('marginright')); nav.append(indicator.css("left", left) .css({"width":width, "left":left}, 500, function() { //links.hover(hoveron, hoverout); })); } function hoveron() { link = $(".nav .hover a"); control(link.innerwidth(), link.offset().left - ($(window).width()-$(".wrapper").width())/2 - $(".wrapper").width()+$('.nav').width()+parseint($('.nav').css('marginright'))); } function hoverout() { control(width, left); } function control(width, left) { indicator.stop().css({"width":width, "left":left}, 300); } if($("#nav").length>0){ if($("#nav .current a").length>0){ init($(".nav .current a")); }else{ init(links.eq(0)); } } $(window).resize(function() { if($("#nav").length>0){ if($("#nav .current a").length>0){ init($(".nav .current a")); }else{ init(links.eq(0)); } } }) $("#nav li.sub").hover(function(){ $(this).parent().find('li').removeclass('hover'); $(this).addclass('hover'); var i=$("#nav li").index(this)-1; if(i>=0){ $('#sub-nav .sub-nav-item').removeclass("hover"); $('#sub-nav').addclass('hover'); //$('#sub-nav .sub-nav-bg').addclass('hover'); if(i>=0){ $('#sub-nav div.sub-nav-item:eq('+i+')').addclass("hover"); }; } cleartimeout(timeout); hoveron(); }, function(){ $(this).removeclass('hover'); var i=$("#nav li").index(this)-1; timeout=settimeout(function(){ $('#sub-nav div.sub-nav-item:eq('+i+')').removeclass("hover"); $('#sub-nav').removeclass('hover'); //$('#sub-nav .sub-nav-bg').removeclass('hover'); },10); hoverout(); }) $('#sub-nav .sub-nav-item').hover(function(){ $('#sub-nav').addclass('hover'); //$('#sub-nav .sub-nav-bg').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); hoveron(); },function(){ $('#sub-nav').removeclass('hover'); //$('#sub-nav .sub-nav-bg').removeclass('hover'); var i=$("#sub-nav div.sub-nav-item").index(this)+1; $('#nav li:eq('+i+')').removeclass('hover'); timeout=settimeout(function(){ $('#sub-nav div.sub-nav-item:eq('+i+')').removeclass("hover"); },10); hoverout(); }) $('#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); } }) $(".member-link").click(function(){ if(!$("body").hasclass("open")){ $("body").addclass('open'); $(this).addclass('hover'); }else{ $("body").removeclass('open'); $(this).removeclass('hover'); } }) jquery(".news-slider").slide({titcell:".hd li",maincell:".bd ul",effect:"leftloop",trigger:"click",autoplay:true,delaytime:700,intertime:6000,easing:"easeinoutexpo"}); $(".index-friendlink .select").each(function(){ $(this).hoverdelay({ hoverevent:function(){ $(this).find("ul").slidedown(200); $(this).addclass("hover"); $(this).find("strong").addclass("hover"); },outevent: function(){ $(this).find("ul").slideup(200); $(this).removeclass("hover"); $(this).find("strong").removeclass("hover"); } }); }); jquery('.photo-slider ul').bxslider({ slidemargin:20, minslides: 2, maxslides: 2, slidewidth: 210, auto:false, pause:6000 }); $(".arrow-left").click(function(){ $(".photo-slider .bx-prev").trigger("click"); }) $(".arrow-right").click(function(){ $(".photo-slider .bx-next").trigger("click"); }) $("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").hover(function () { $(this).parent().parent().find("a.current").removeclass("current"); $(this).addclass("current"); for(var i=0;i<$(this).parent().parent().find("a").length;i++){ $("#"+$(this).parent().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); } }()); $("#follow-btn").css("right",($(window).width()-$(".wrapper").width())/4-30+"px"); $(".back-top").click(function(){ $('html,body').animate({scrolltop: '0px'}, 400); return false; }) $(window).resize(function() { $("#follow-btn").css("right",($(window).width()-$(".wrapper").width())/4-30+"px"); }) }); var tur = true; function haha(){ t = $(document).scrolltop(); if(t > 200){ $('#follow-btn').css("bottom","120px"); $('#header').addclass("hover"); $('#sub-nav').removeclass('hover'); }else{ $('#follow-btn').css("bottom","-200px"); $('#header').removeclass("hover"); } tur = true; } window.onscroll = function(){ if(tur){ settimeout(haha,1); tur = false; }else{ } }