$(function () { banner(); showimg(); /*经典案例*/ $("#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 }); }); }); function showimg(){ if($("#showimg").length > 0){ $('#showimg').banqh({ box: "#showimg",//总框架 pic: "#bigimg",//大图框架 pnum: "#smallimg",//小图框架 prev_btn: ".prev",//小图左箭头 next_btn: ".next",//小图右箭头 autoplay: true,//是否自动播放 intertime: 5000,//图片自动切换间隔 delaytime: 400,//切换一张图片时间 order: 0,//当前显示的图片(从0开始) picdire: true,//大图滚动方向(true为水平方向滚动) mindire: true,//小图滚动方向(true为水平方向滚动) min_picnum: 5,//小图显示数量 pop_up: false//大图是否有弹出框 }); } } $('#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(); } } }