$(function(){ /*load*/ /*if(screenwidth>=1680&&screenwidth<1780){ cutstrings(210,260,120,120,210,210,500); }else if(screenwidth>=1200&&screenwidth<1680){ cutstrings(210,200,60,80,100,100,300); }else if(screenwidth>=1780){ cutstrings(300,260,120,140,210,210,500); }else if(screenwidth>=1024&&screenwidth<1199){ cutstrings(160,100,120,140,0,0,0); }else if(screenwidth<1023){ cutstrings(160,100,120,140,0,0,0); }*/ /*navbtn*/ $("#listclosebtn").click(function(){ $(".list").stop(false,true).animate({ "top":"-800px", "opacity":"0" },500); }); navbtnbool=true; $(".navbtn").click(function(){ $(this).toggleclass("wapbtnan"); var screenwidth=$(window).width(); if(screenwidth>=1024){ if(navbtnbool){ $(".list").stop(false,true).animate({ "top":"0px", "opacity":"1" },500); }else{ $(".list").stop(false,true).animate({ "top":"-800px", "opacity":"0" },500); } }else{ if(navbtnbool){ $(".nav").css("height",$(document.body).height()).show(); $(".nav").animate({ "right":"0px" },500); navbtnbool=false; }else{ $(".nav").hide(); $(".nav").animate({ "right":"-125px" },500); navbtnbool=true; } } }); $("#footchildcode").mouseover(function(){ $(this).find(".childcode").stop(false,true).fadein(200); }).mouseleave(function(){ $(this).find(".childcode").stop(false,true).fadeout(200); }); $("#listname").focus(function(){ if($(this).val()=="您的姓名"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("您的姓名"); } }); $("#listcompany").focus(function(){ if($(this).val()=="公司名称"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("公司名称"); } }); $("#listemail").focus(function(){ if($(this).val()=="您的电话"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("您的电话"); } }); $("#listtitle").focus(function(){ if($(this).val()=="项目主题"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("项目主题"); } }); $("#listinfo").focus(function(){ if($(this).val()=="告诉我们您的项目基本信息"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("告诉我们您的项目基本信息"); } }); /*fixed*/ var floatbool=false; $(window).scroll(function(){ if($(this).scrolltop()>=200){ if(!floatbool){ $(".fixed").stop(false,true).fadein(500); floatbool=true; } }else{ if(floatbool){ $(".fixed").stop(false,true).fadeout(500); floatbool=false; } } }); $(".fixedtop").mouseover(function(){ $(this).css("background","#666"); var imagesrc=$(this).find(".fixedtoppointer").attr("src"); if(imagesrc.indexof("on.png")>0){}else{ imagesrc=imagesrc.replace(".png","on.png"); } $(this).find(".fixedtoppointer").attr("src",imagesrc); }).mouseleave(function(){ $(this).css("background","#cbcbcb"); var imagesrc=$(this).find(".fixedtoppointer").attr("src"); if(imagesrc.indexof("on.png")>0){ imagesrc=imagesrc.replace("on.png",".png"); }else{} $(this).find(".fixedtoppointer").attr("src",imagesrc); }).click(function(){ $('body').animate({scrolltop:"0px"},500); }); $(".fixedcode").mouseover(function(){ $(".fixedcodeinfo").stop(false,true).fadein(500); }).mouseleave(function(){ $(".fixedcodeinfo").stop(false,true).fadeout(500); }); }); /*animateclassadd*/ function anclasadd(e,keyframes,stime,dtime,an,status){ $(e).css({ "animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-moz-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-webkit-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, "-o-animation":keyframes+" "+stime+" "+an+" "+dtime+" "+status, }); } /*cutstring*/ function cutstring(str, len) { if(str.length*2 <= len) { return str; } var strlen = 0; var s = ""; for(var i = 0;i < str.length; i++) { s = s + str.charat(i); if (str.charcodeat(i) > 128) { strlen = strlen + 2; if(strlen >= len){ return s.substring(0,s.length-1) + "..."; } } else { strlen = strlen + 1; if(strlen >= len){ return s.substring(0,s.length-2) + "..."; } } } return s; } function movemain(ele){ var top=parseint($(ele).offset().top); var headertop=parseint($(".header").css("height")); top=top-headertop; $('body').animate({scrolltop:top},500); } function contactsubmit(url,username,company,email,project,info){ if($.trim(username)=="您的姓名"||$.trim(username)==""){alert("请填写您的姓名,便于我们的联系");return;} if($.trim(company)=="公司名称"||$.trim(company)==""){alert("请填写公司名称,便于我们的联系");return;} if($.trim(email)=="您的电话"||$.trim(email)==""){alert("请填写您的电话,便于我们的联系");return;} if($.trim(project)=="项目主题"||$.trim(project)==""){alert("请填写项目主题,便于我们的联系");return;} if($.trim(info)=="告诉我们您的项目基本信息"||$.trim(info)==""){alert("请填写您的项目基本信息,便于我们的联系");return;} $.post( url, { 'username':username, 'company':company, 'email':email, 'project':project, 'info':info }, function(data){ if(data==1){ alert("提交成功!我们会尽快联系您们。"); $("#listname").val("您的姓名"); $("#listcompany").val("公司名称"); $("#listemail").val("您的电话"); $("#listtitle").val("项目主题"); $("#listinfo").val("告诉我们您的项目基本信息"); $("#listname1").val("您的姓名"); $("#listcompany1").val("公司名称"); $("#listemail1").val("您的电话"); $("#listtitle1").val("项目主题"); $("#listinfo1").val("告诉我们您的项目基本信息"); }else{ alert("提交失败!"); } } ); }