// javascript document $(function(){ pagesize(); }) function pagesize(){ if($(window).width() > 1280){ $("body").attr("class","width1600"); }else{ $("body").attr("class","width1280"); } $("#loading").css("height",$(window).height()); } $(window).resize(function(){ pagesize(); }) window.onload = function() { pagesize(); } /***********************banner***********************/ $(function(){ var bannerlist=$('.banner ul li'); var bannerbtn=$('.arrows a'); var i=0; $(".banner ul li").css("display","none").eq(0).css("display","block") function banner(){ if(i<0){ i=bannerlist.length-1; }else if(i>bannerlist.length-1){ i=0; } bannerlist.eq(i).fadein().siblings().fadeout(); bannerbtn.eq(i).addclass('arrows_a').siblings().removeclass('arrows_a'); } banner(); function next(){ i++; banner(); } var time=setinterval(next,3000); bannerbtn.hover(function(){ clearinterval(time); i=$(this).index(); banner(); },function(){ time=setinterval(next,3000); }) }); /***********************首页选项卡***********************/ var flag = false; var scro_zoom; var scromouse; var scro; var scrowidth; var scromove; var scroimgwidth; var scroimglength; var scroimgboxwidth; var zoompos; var scropos; function lsdfjlakj(index) { scro_zoom = parseint($(".ind_gdt_d:eq(0)").width() / 2); scromouse = parseint($(".ind_gdt_d").width()); scro = $(".ind_pro_bj").eq(index); scrowidth = parseint($(".ind_pro_bj").eq(index).width()); scromove = $(".ind_gdt_xs:eq(" + index + ") ul"); scroimgwidth = parseint($(".ind_gdt_xs:eq(" + index + ") ul li").width()); scroimglength = $(".ind_gdt_xs:eq(" + index + ") ul li").length; scroimgboxwidth = scroimgwidth * scroimglength + scroimglength; zoompos = { x: 0, y: 0 }; scromove.css("width", scroimgboxwidth + "px"); $(".ind_gdt_d").eq(index).bind("mousedown", function(e) { flag = true; $(this); //.css("background","blue") return false; }).mousemove(function(e) { if (flag) { $zoompos(e.pagex, e.pagey); $(this).css("left", zoompos.x); scromove.css("left", -scropos + "px"); } }).mouseup(function(e) { flag = false; }) $(document).mouseup(function(e) { flag = false; }) } function $zoompos(x, y) { zoompos.x = x - scro.offset().left - scro_zoom; //得到left值; zoompos.y = y - scro.offset().top - 4; //得到top值; scropos = parseint((scroimgboxwidth - scrowidth) / (scrowidth - scromouse) * zoompos.x); if (zoompos.x <= 0) { zoompos.x = 0; } if (zoompos.x + scromouse >= scrowidth) { zoompos.x = scrowidth - scromouse; } if (scropos < 0) { scropos = 0; } if (scropos >= scroimgboxwidth - scrowidth) { scropos = scroimgboxwidth - scrowidth; } } $(".ind_pro_ul").each(function(index, element) { $(this).mousewheel(function(event, delta) { var cuindex = $(".ind_pro_ul").index($(".ind_pro_ul:visible")); //alert( parseint($(".ind_gdt_d").width())/$(".ind_gdt_xs:eq(" + cuindex + ") ul li").length) if(delta>0&&parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))<0) $(".ind_gdt_d").eq(cuindex).css("left", $(".ind_gdt_d").eq(cuindex).offset().left-10-$(".ind_pro_bj").eq(cuindex).width()/$(".ind_gdt_xs:eq(" + cuindex + ") ul li").length); else if(delta<0&&parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))>-($(".ind_gdt_xs:eq(" + index + ") ul").width()-$(window).width()-400)) $(".ind_gdt_d").eq(cuindex).css("left", $(".ind_gdt_d").eq(cuindex).offset().left+10+$(".ind_pro_bj").eq(cuindex).width()/$(".ind_gdt_xs:eq(" + cuindex + ") ul li").length); if(delta>0&&parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))<0) $(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left", (parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))+400) + "px"); else if(delta<0&&parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))>-($(".ind_gdt_xs:eq(" + index + ") ul").width()-$(window).width()-400)) $(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left", (parseint($(".ind_gdt_xs:eq(" + cuindex + ") ul").css("left"))-400) + "px"); event.stoppropagation(); event.preventdefault(); }); }); $(function() { lsdfjlakj(0); var abtnss = $('.ind_xxk li'); var adivss = $('.ind_pro_bot .ind_pro_ul'); abtnss.click(function() { $(this).addclass('xxk_a').siblings().removeclass('xxk_a'); adivss.eq($(this).index()).show().siblings().hide(); lsdfjlakj($(this).index()); }); }); /***********************首页新闻***********************/ $(function(){ var aelesse=$('.slide1 > ul'); var belesse=$('.slide2 > ul'); var ise=0; var val=0; var abtnse=$('.ind_news_top .ind_news1 a'); var bbtnse=$('.ind_news_top .ind_news2 a'); function show() { if(ise<0) { ise=aelesse.length-1; } else if(ise>aelesse.length-1) { ise=0; } aelesse.eq(ise).show().siblings().hide(); abtnse.eq(ise).addclass('s1_a1').siblings().removeclass('s1_a1'); } function user() { if(val<0) { val=belesse.length-1; } else if(val>belesse.length-1) { val=0; } belesse.eq(val).show().siblings().hide(); bbtnse.eq(val).addclass('s1_a1').siblings().removeclass('s1_a1'); } show(); user(); function next() { ise++; show(); } function news() { val++; user(); } abtnse.hover(function(){ ise=$(this).index(); show(); }); bbtnse.hover(function(){ val=$(this).index(); user(); }); }); /***********************首页视频***********************/ /***********************返回顶部***********************/ $(function(){ $(".ind_top").click(function(){ $('body,html').animate({scrolltop:0},500); }); }) /***********************产品分类***********************/ $(function(){ jquery(".pro_l li:not('.pro_li_a')").hover(function(){ $(this).find("div").stop(true).hide().slidedown(1000) },function(){ $(this).find("div").stop(true).show().slideup(1000) }) }) /***********************首页选项卡***********************/ $(function(){ var abtnss=$('.proshow_bot li'); var adivss=$('.proshow_bot_xxk .proshow_can'); abtnss.click(function(){ $(this).addclass('xxk_cur').siblings().removeclass('xxk_cur'); adivss.eq($(this).index()).show().siblings().hide(); }); }); /***********************honor***********************/ $(function(){ var ullist=$('.hon_n ul'); var ele=ullist.children(); var prev=$('.hon_l'); var next=$('.hon_r'); var is=119; var w=0; var ssd=ele.length $(".hon_n ul li").eq(0).addclass("lsdava"); function nexts() { if(w<0) { w=0; } else if(w>ssd-8) { w=ssd-8; } ullist.animate({left:-is * w},500); $(".hon_n ul li").eq(w).addclass("lsdava").siblings("li").removeclass("lsdava"); $(".hon_con .hon_bot").eq(w).show().siblings(".hon_bot").hide(); } prev.click(function(){ w--; nexts(); }); next.click(function(){ w++; nexts(); }); $(".hon_n li").click(function(){ $(".hon_con .hon_bot").eq($(this).index()).show().siblings(".hon_bot").hide(); $(this).addclass("lsdava").siblings("li").removeclass("lsdava"); }) })