/*网站底部返回顶部*/ $(function(){ $('#returntop').bind('click',function(){ $('html,body').animate({scrolltop:$('.header').offset().top},500); return false; }); }) /*表单验证*/ function reg(ele_name,txt){ var load_name = $(txt).val(); $(ele_name).submit(function(){ var name = $(txt).val(); if($.trim(name)=='' || name == load_name){ $(txt).css('border-color','red'); $(txt).focus(); return false; } }) } /*******以下不得删除*******/ /*产品内页产品放大左右滚动效果*/ $(function(){ $(".items ul li img").hover(function(){ var img_url=$(this).attr("src"); $(this).closest(".showb_scroll").siblings(".showb_preview").children("span").children("img").attr("src",img_url); /*var img_bimg=$(this).attr("bimg"); $(this).closest(".showb_scroll").siblings(".showb_preview").children("span").children("img").attr("jqimg",img_bimg);*/ }) /*if($(".showb_preview").children(".jqzoom").length>0){ $(".jqzoom").jqueryzoom({xzoom:380,yzoom:410}); }*/ //下一张 //var templength = 0; //临时变量,当前移动的长度 $(".showb_scroll .next").bind("click",function(){ var templength = number($(this).parent(".showb_scroll").attr("bimg")) var viewnum = 1; //设置每次显示图片的个数量 var movenum = 2; //每次移动的数量 var movetime = 300; //移动速度,毫秒 var scrolldiv = $(this).siblings(".items").children("ul")//$(".showb_scroll .items ul"); //进行移动动画的容器 var scrollitems = $(this).siblings(".items").children("ul").children("li")//$(".showb_scroll .items ul li"); //移动容器里的集合 var movelength = scrollitems.eq(0).width() * movenum; //计算每次移动的长度 var countlength = (scrollitems.length - viewnum) * scrollitems.eq(0).width(); //计算总长度,总个数*单个长度 if(templength < countlength){ if((countlength - templength) > movelength){ scrolldiv.animate({left:"-=" + movelength + "px"}, movetime); templength += movelength; $(this).parent(".showb_scroll").attr("bimg",templength) }else{ scrolldiv.animate({left:"-=" + (countlength - templength) + "px"}, movetime); templength += (countlength - templength); $(this).parent(".showb_scroll").attr("bimg",templength) } } }); //上一张 $(".showb_scroll .prev").bind("click",function(){ var templength = number($(this).parent(".showb_scroll").attr("bimg")) var viewnum = 1; //设置每次显示图片的个数量 var movenum = 2; //每次移动的数量 var movetime = 300; //移动速度,毫秒 var scrolldiv = $(this).siblings(".items").children("ul")//$(".showb_scroll .items ul"); //进行移动动画的容器 var scrollitems = $(this).siblings(".items").children("ul").children("li")//$(".showb_scroll .items ul li"); //移动容器里的集合 var movelength = scrollitems.eq(0).width() * movenum; //计算每次移动的长度 var countlength = (scrollitems.length - viewnum) * scrollitems.eq(0).width(); //计算总长度,总个数*单个长度 if(templength > 0){ if(templength > movelength){ scrolldiv.animate({left: "+=" + movelength + "px"}, movetime); templength -= movelength; $(this).parent(".showb_scroll").attr("bimg",templength) }else{ scrolldiv.animate({left: "+=" + templength + "px"}, movetime); templength = 0; $(this).parent(".showb_scroll").attr("bimg",templength) } } }); }); $(function(){ $('.nav ul li:last').css("background","none"); $('.banner .flexslider').flexslider({ animation: "slide"//也可以写fade }); }) $(function(){ $('.nav li').hover(function(){ $(this).addclass('select').siblings('li').removeclass('select') },function(){ $(this).removeclass('select') }) }) $(function(){ $('.in_pro ul li:first').css("border","none") }) // javascript document $(function(){ //导航 $(".topnavul ul li:first-child").css("margin-left","24px"); $(".topnavul ul li:last-child").css("background","none"); //产品展示 $(".pro_show dl:nth-child(3n+1)").css("margin-left","0px"); $(".nypro li:nth-child(3n+1)").css("margin-left","0px"); //工程案例 $(".casec dl:nth-child(4n+1)").css("margin-left","0px"); //首页新闻 $(".newr:nth-child(2)").css("background","url(../images/01.png) no-repeat left 30px"); $(".newr:nth-child(3)").css("background","url(../images/03.png) no-repeat left 30px"); })