$(function(){ banner(); tools(); share(); tablist(); if($(".imglist").length){ $(".imglist").each(function(){ var _this=$(this); imglist(_this); }); } if(window.screen.width < 1681){ $(".header_main").addClass("headeiw8"); } }); // banner焦点图 function banner() { if (!$("#banner").length || $("#banner li").length <= 1) { return false; } $("#banner ul li:gt(0)").css({"display":"none"}); var b = $("#banner"), me = $("#banner ul"), tip = $("#banner .tip"), t, interval = 10000, speed = 1000, speed2 = 700, n = 0, N = me.children("li").length; wid = b.children("li").width(); step = 200,time = 3000; if ($("#banner .tip").length) { var htmlTip = ""; for (var i = 0; i < N; i++) { if (i == 0) { htmlTip += ""+(i+1)+""; } else { htmlTip += ""+(i+1)+""; } } tip.html(htmlTip); } var func = function() { if (n >= N - 1) { n = 0; }else if(n < -1){ n = N-1; } else { n++; } me.children("li").eq(n).css({ "z-index": 2 }).stop().fadeIn(speed).siblings("li").css({ "z-index": 1 }).stop().fadeOut(speed2); if ($("#banner .tip").length) { tip.children("span").eq(n).addClass("cur").siblings("span").removeClass("cur"); } } $("#banner").hover(function(){ $("#btn_prev,#btn_next").fadeIn() },function(){ $("#btn_prev,#btn_next").fadeOut() }) $dragBln = false; $("#btn_prev").click(function(){ clearInterval(t); n -= 2; func(); t = setInterval(func, time) }); $("#btn_next").click(function(){ clearInterval(t); func(); t = setInterval(func, time) }); tip.children("span").click(function() { clearInterval(t); n = $(this).index() - 1; func(); t = setInterval(func, interval); }) $("#banner ul.list li").mouseenter(function() { clearInterval(t); }).mouseleave(function() { t = setInterval(func, time); }); t = setInterval(func, interval); } function tablist(){ $(".menu .sbox p").click( function (e) { if($(".menu .sbox .lc").is(":hidden")){ $(".menu .sbox .lc").show(); }else{ $(".menu .sbox .lc").hide(); } e.stopPropagation(); }); $("body").click(function () { $(".menu .sbox .lc").hide(); }); $(".menu .sbox .lc a").click(function () { var html = $(this).html(); $(".menu .sbox").find("p").html(html); $(".menu .sbox .lc").hide(); }); } // 集成JS效果 function tools(){ // 设为首页 $(".setHome").click(function(){ var hm = window.location.host; SetHome(this, location.href); }); // 加入收藏 $(".addFavo").click(function(){ var fm = $("title").html(); AddFavorite(fm, location.href, ''); }); $("#gotop").click(function() { $("body, html").stop().animate({ "scrollTop": 0 }); }); $(".search-box .butn").on('click', function () { if ($(this).hasClass('hov')) { $(this).removeClass('hov'); $(this).siblings('.share-sub').stop().animate({ width: 288 }, 500); } else { $(this).addClass('hov'); $(this).siblings('.share-sub').stop().animate({ width: 0 }, 500); } }); $(window).scroll(function () { var i = $(window).scrollTop(); if (i > 10) { $(".header_main").addClass("fixt"); } else if (i < 9) { $(".header_main").removeClass("fixt"); } if (i > 200) { $(".location").addClass("fixt"); } else if (i < 199) { $(".location").removeClass("fixt"); } }); // 合作模式 $(".steps").slide({titOnClassName:"current"}); $(".slideTxtBox").slide({effect:"left"}); $("#ichoose").slide({mainCell:".bd ul",autoPage:true,effect:"left",autoPlay:true,vis:3}); $("#newsBox").slide({mainCell:".bd ul",autoPlay:true,effect:"left",delayTime:500,interTime:6000}); $('#toolbar dd').bind({ 'mouseenter': function(){ if($(this).children('.slide').length){ var _this = $(this).children('.slide'); _this.stop(true, true).animate({'width': 130}, 200); }else if($(this).children('.pop').length){ var _this = $(this).children('.pop'); _this.show().animate({'right':150}, 200); } }, 'mouseleave': function(){ if($(this).children('.slide').length){ var _this = $(this).children('.slide'); _this.stop(false, false).animate({'width': 0}, 200); }else if($(this).children('.pop').length){ var _this = $(this).children('.pop'); _this.hide().animate({'right': 90}, 200); } } }); } function imglist(_this){ if ( _this.find(".item").length <= 1) { return false; } var t, a = _this; var clone = a.find(".list").html(); a.find(".list").append(clone); // 克隆数据 var n = 0, N = a.find(".list").children(".item").length, wid = a.find(".list").children(".item").width(), time = 5000, step = 600; a.find(".list").width(N * wid); var func = function() { if (n >= N / 2) { n = 0; a.find(".list").css({ "margin-left": 0 }); func(); } else { n++; a.find(".list").stop().animate({ "margin-left": -wid * n }, step); } } var func2 = function() { if (n <= 0) { n = N / 2; a.find(".list").css({ "margin-left": -wid * n }); func2(); } else { n--; a.find(".list").stop().animate({ "margin-left": -wid * n }, step); } } // 手动触发滚动效果::向右箭头 _this.find(".next").click(function() { // clearInterval(t); func(); }); // 手动触发滚动效果::向左箭头 _this.find(".prev").click(function() { // clearInterval(t); func2(); }); // 自动执行 if(_this.parents(".floor_5").length){ }else{ t = setInterval(func, time); a.hover(function() { clearInterval(t); },function() { t = setInterval(func, time); } ); } } function share(){ window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {}, "slide": { // 跟图标式的代码相比,这里是添加了浮窗式 slide 属性配置 "type": "slide", "bdImg": "5", "bdPos": "left", "bdTop": "100" } }; window._bd_share_config = { share : [{ "bdSize" : 16 }], } with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)]; } /* 搜索提示 */ function checksearch(the) { if ($.trim(the.key.value) == '') { alert('请输入关键字'); the.key.focus(); the.key.value = ''; return false } if ($.trim(the.key.value) == '请输入关键字') { alert('请输入关键字'); the.key.focus(); the.key.value = ''; return false } }