/*网站底部返回顶部*/ $(function(){ $('#returntop').bind('click',function(){ $('html,body').animate({scrolltop:$('.header').offset().top},500); return false; }); }) /*首页留言*/ $(function(){ focus_blur_val(".search_cnt input,.guestbookrtp input,.guestbookrt textarea"); reg("#searchform",".txt"); }) $(function(){ $("#form_do").submit(function(){ var username = $("input[name='username']").val(), tel = $("input[name='tel']").val(), texar = $(".texar").val(); if(username == "您的姓名" || $.trim(username) == ""){ $("input[name='username']").css('border-color','red'); return false; }else if (tel == "您的电话" || $.trim(tel) == ""){ $("input[name='tel']").css('border-color','red'); return false; }else if($("#form_do textarea").hasclass("texar")){ if(texar == "您的留言" || $.trim(texar) == ""){ $(".texar").css('border-color','red'); return false; } } }) }) function focus_blur_val(classname){ $(classname).bind("focus",function(){ var this_val=$(this).val(); if(this_val==this.defaultvalue){ $(this).val(""); } }).bind("blur",function(){ var this_val=$(this).val(); if(this_val==""){ $(this).val(this.defaultvalue); } }) } /*表单验证*/ 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") }) $(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") }); $(function(){ $(".worklist2").caroufredsel({ direction: 'left', prev: '#case_progress_prev2', next: '#case_progress_next2', circular: true, infinite: true, items: { visible: 4, minimum: 3 }, align: false, auto: { play: true, timeoutduration: 1000 }, scroll:{ items:1, pauseonhover: true } }); }); $(function(){ $(".worklist_1").caroufredsel({ direction: 'left', circular: true, infinite: true, items: 1, align: false, auto: true, prev: '#case_progress_prev_1', next: '#case_progress_next_1' }); }); $(function(){ $(".nav li:eq(4)").css("margin-left", "290px"); $(".nav li:eq(6)").css("text-align", "right"); $(".nav li:eq(5)").css("text-align", "center"); })