$(function () { banner(); /*缁忓吀妗堜緥*/ $("#icase").slide({ titcell: '.hd ul', maincell: '.bd ul', autoplay: true, effect: "leftloop", autopage: true, delaytime: 500, intertime: 5000, trigger: "click", vis: 4 }); /*浜у搧涓績-鎺ㄨ崘*/ $("#product").slide({ titcell: '.hd ul', maincell: '.bd ul', autoplay: true, effect: "leftloop", autopage: true, delaytime: 500, intertime: 5000, trigger: "click", vis: 1 }); /*鏂伴椈璧勮*/ $("#newsbox").slide({ titcell: '.hd ul', maincell: '.bd ul', autoplay: true, effect: "leftloop", autopage: true, delaytime: 500, intertime: 5000, trigger: "click", vis: 1 }); $(".ewmbtn").click(function(){ $("body .ewmbox").show(); layout(1); }); $(".ewmbox .close").click(function(){ $(".ewmbox").hide(); layout(0); }); $("#xcxbtn").click(function(){ $("body .ewmbox").show(); layout(1); }); $("#xcxbtn1").click(function(){ $("body .ewmbox").show(); layout(1); }); $(".ewmbox .close").click(function(){ $(".ewmbox").hide(); layout(0); }); $("#top").click(function() { $("body, html").stop().animate({ "scrolltop": 0 }); }); }); $('#toolbar dd').bind({ 'mouseenter': function () { if ($(this).children('.slide').length) { var _this = $(this).children('.slide'); _this.stop(true, true).animate({ 'width': 220 }, 200); } else if ($(this).children('.pop').length) { var _this = $(this).children('.pop'); _this.show().animate({ 'right': 65 }, 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 }, 230); } } }); // banner function banner() { if (!$("#banner").length || $("#banner .list li").length <= 1) { return false; } var _this = $("#banner"), me = $("#banner .list"), tip = $("#banner .tip"), prev = _this.find("#btn_prev"), next = _this.find("#btn_next"), t, interval = 5000, speed = 1000, speed2 = 700, n = 0, n = me.children("li").length; me.find("li:gt(0)").hide(); if ($("#banner .tip").length) { var htmltip = ""; for (var i = 0; i < n; i++) { if (i == 0) { htmltip += ""; } else { htmltip += ""; } } tip.append(htmltip); } var func = function () { if (n >= n - 1) { n = 0; } 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"); } } t = setinterval(func, interval); next.bind("click", function () { clearinterval(t); func(); }); prev.bind("click", function () { clearinterval(t); n -= 2; n < -1 ? n = n - 2 : n; func(); }); tip.children("span").mouseover(function () { clearinterval(t); n = $(this).index() - 1; func(); }); $("#banner").hover(function () { $("#btn_prev,#btn_next").fadein() }, function () { $("#btn_prev,#btn_next").fadeout() }) $("#banner_main").hover(function () { console.log(1) clearinterval(t); }, function () { console.log(2) t = setinterval(func, interval); }); } //layout function layout(u){ var $obj = $('
'); if(u == 0){ $('.dialog-layout').remove(); }else{ if(!$('.dialog-layout').length){ $obj.appendto('body').show(); } } }