$(function () { banner(); share(); tool(); relatepro(); relatepro2(); isolution(); iadvantage(); // iproduct(); // piaofu(); $(".amore").click(function(){ $(this).addClass("hover"); }); $(".xfupic span").click(function() { $(".xfupic").stop().hide(); }); $(".nav_main li").hover(function(){ // $(this).find(".subNav").stop().slideDown(300); },function(){ // $(this).find(".subNav").stop().slideUp(300); }); $(window).scroll(function() { var a = $(document).scrollTop(); if(a>=200){ $(".goTop").show(); }else{ $(".goTop").hide() } }); $(".goTop").click(function() { $("body, html").stop().animate({ "scrollTop": 0 }); }); }); function piaofu(){ var timer=null;/*定时器*/ var _left=0;/*默认left距离*/ var _top=20;/*默认top距离*/ var top_folg=false;/*控制高度-锁*/ var left_folg=true;/*控制宽度-锁*/ var win_width=$(window).width()-$(".xfupic").width()-60;/*获取并计算浏览器初始宽度*/ var win_height=$(window).height()-$(".xfupic").height();/*获取并计算浏览器初始高度*/ $("#liulan").html(win_height+"px"); $("#sumwid").html(win_width+"px");; action();/*执行走动*/ $(".xfupic").mouseover(function(){ clearInterval(timer); // $(this).find(".c_adver").css({"background":"url('images/no.gif')","bakcground-repeat":"no-repeat"}); // $(this).find(".txt").text("放开我!!!"); }).mouseout(function(){ action(); // $(this).find(".txt").text("杜绝广告"); // $(this).find(".c_adver").css({"background":"url('images/back.gif')","bakcground-repeat":"no-repeat"}); }); $(window).resize(function(){ conobj=$(".conent"); win_width=$(window).width()-conobj.width()-60; win_height=$(window).height()-conobj.height(); $("#liulan").html(win_height+"px"); $("#sumwid").html(win_width+"px");; }); function action(){ timer=setInterval(function(){ if(!top_folg){ _top++; if(_top>=win_height){top_folg=true;}; }else{ _top--; if(_top<=0){top_folg=false;}; }; if(left_folg){ _left++; if(_left>=win_width){left_folg=false;}; }else{ _left--; if(_left<=0){left_folg=true;}; }; $("#textone").html(_top+"px"); $("#timewid").html(_left+"px"); $(".xfupic").animate({ left:_left, top:_top },3); },15); }; $(".xfupic .c_adver").dblclick(function(){ $(this).parents(".xfupic").slideUp(500,function(){ $(this).remove(); clearInterval(timer); }); }); var state;/*拖动锁*/ $(".c_header").mousedown(function(event){ state=false; var x=event.clientX; var y=event.clientY; var obj=$(this).parents(".xfupic"); var c_left=obj.offset().left; var c_top=obj.offset().top; $(document).mousemove(function(e){ if(!state){ var x1=e.clientX; var y1=e.clientY; var action_left=x1-x+c_left; var action_top=y1-y+c_top; if(action_left<=0){action_left=0;}; if(action_top<=0){action_top=0;} if(action_left>=win_width){action_left=win_width;}; if(action_top>=win_height){action_top=win_height;}; obj.css({top:action_top,left:action_left}); _left=action_left; _top=action_top; $("#text").html(_top+"px"); $("#dywid").html(_left+"px"); }; }).mouseup(function(){ state=true; }); }); }; function tool(){ if($(".multi-img").length){ var _a=$(".multi-img"); _a.find(".simg li").hover(function(){ var _big=$(this).find("img").attr("data-big"); $(this).addClass("hover").siblings().removeClass("hover"); _a.find(".bigimg img").attr("src",_big); }); } }; function iproduct() { if(!$("#iproduct").length){ $("#iproduct").find(".prev,.next").hide(); return false; } var _list = $("#iproduct").find(".con"); var t, a = _list.find(".list"), time = 3000, length = a.children(".item").length, step = 300, c = a.width(), d = _list.find(".item").width() + 21, n = 1; var clone = a.html(); // a.append(clone); a.width(length * c); var func = function () { a.children(".item").eq(n).addClass("hover").siblings(".item").removeClass("hover"); } $("#iproduct .next").click(function () { console.log(n) if(n >= length-1) { n = 0; } else { n++; } func(); }); $("#iproduct .prev").click(function () { if(n <= 0) { n = length-1; } else { n--; } func(); }); } //iadvantage function iadvantage(){ if(!$("#iadvantage").length || $("#iadvantage").find(".list li").length < 2){ $("#iadvantage").find(".prev,.next").hide(); return false; } var t, a = $("#iadvantage .list"); var clone = a.html(); a.append(clone); // 克隆数据 var n = 0, N = a.children("li").length, wid = a.children("li").width(), time = 4000, step = 500; a.width(N*wid); var func = function(){ if(n >= N/2){ n = 0; a.css({"margin-left":0}); func(); }else{ n++; a.stop().animate({"margin-left":-wid*n}, step); } } var func2 = function(){ if(n <= 0){ n = N/2; a.css({"margin-left":-wid*n}); func2(); }else{ n--; a.stop().animate({"margin-left":-wid*n}, step); } } t = setInterval(func, time); // 绑定按钮事件 $("#iadvantage .prev").click(function(){ clearInterval(t); func2(); }); $("#iadvantage .next").click(function(){ clearInterval(t); func(); }); } //isolution function isolution(){ if(!$("#isolution").length || $("#isolution").find(".list .item").length < 2){ $("#isolution").find(".prev,.next").hide(); return false; } var t, a = $("#isolution .list"); var clone = a.html(); a.append(clone); // 克隆数据 var n = 0, N = a.children(".item").length, wid = a.children(".item").width(), time = 3000, step = 500; a.width(N*wid); var func = function(){ if(n >= N/2){ n = 0; a.css({"margin-left":0}); func(); }else{ n++; a.stop().animate({"margin-left":-wid*n}, step); } } var func2 = function(){ if(n <= 0){ n = N/2; a.css({"margin-left":-wid*n}); func2(); }else{ n--; a.stop().animate({"margin-left":-wid*n}, step); } } // 绑定按钮事件 $("#isolution .prev").click(function(){ func2(); }); $("#isolution .next").click(function(){ func(); }); } //relatepro function relatepro(){ if(!$("#relate-pro").length || $("#relate-pro").find(".list li").length < 4){ $("#relate-pro").find(".prev,.next").hide(); return false; } var t, a = $("#relate-pro .list"); var clone = a.html(); a.append(clone); // 克隆数据 var n = 0, N = a.children("li").length, wid = a.children("li").width() + 32, time = 3000, step = 300; a.width(N*wid); var func = function(){ if(n >= N/2){ n = 0; a.css({"margin-left":0}); func(); }else{ n++; a.stop().animate({"margin-left":-wid*n}, step); } } var func2 = function(){ if(n <= 0){ n = N/2; a.css({"margin-left":-wid*n}); func2(); }else{ n--; a.stop().animate({"margin-left":-wid*n}, step); } } // 绑定按钮事件 $("#relate-pro .prev").click(function(){ func2(); }); $("#relate-pro .next").click(function(){ func(); }); } //relatepro function relatepro2(){ if(!$("#relate-pro2").length || $("#relate-pro2").find(".list li").length < 4){ $("#relate-pro2").find(".prev,.next").hide(); return false; } var t, a = $("#relate-pro2 .list"); var clone = a.html(); a.append(clone); // 克隆数据 var n = 0, N = a.children("li").length, wid = a.children("li").width() + 32, time = 3000, step = 300; a.width(N*wid); var func = function(){ if(n >= N/2){ n = 0; a.css({"margin-left":0}); func(); }else{ n++; a.stop().animate({"margin-left":-wid*n}, step); } } var func2 = function(){ if(n <= 0){ n = N/2; a.css({"margin-left":-wid*n}); func2(); }else{ n--; a.stop().animate({"margin-left":-wid*n}, step); } } // 绑定按钮事件 $("#relate-pro2 .prev").click(function(){ func2(); }); $("#relate-pro2 .next").click(function(){ func(); }); } // 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(".prev"), next = _this.find(".next"), t, interval = 4000, 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("li").eq(n).addClass("cur").siblings("li").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("li").mouseover(function() { clearInterval(t); n = $(this).index() - 1; func(); }); _this.hover(function(){ clearInterval(t); },function(){ 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(); } } } function share(){ window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {}, "slide": { // 跟图标式的代码相比,这里是添加了浮窗式 slide 属性配置 "type": "slide", "bdImg": "6", "bdPos": "left", "bdTop": "100" } }; with(document) 0[(getElementsByTagName('head')[0] || body) .appendChild(createElement('script')) .src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)]; }