// javascript document //var site = "http://vcb-odm.com/"; //var site = "//odm/"; var site = 'http://'+location.hostname+'/'; if(location.hostname=='www.mecan.net') site = 'https://www.mecan.net/yunpeijian/'; //滚动条兼容问题 window.onscroll = _onscroll; var wh,ww,th,sh,sw,lcboxy,lcgboxy,isshow=0,ah,t,imgw; $(function(){ $(".inp").focus(function(){ $(this).css({"border-color":"#999","color":"#111"}); }).blur(function(){ $(this).css({"border-color":"#ddd","color":"#666"}); }) //如果是ie浏览器 if ((navigator.useragent.indexof('msie')>=0)&&(navigator.useragent.indexof('opera')<0)){ $(".inpcon input.inp").each(function(index, element) { if($(this).val()!=''){ $(this).next("span").hide(); }else{ $(this).next("span").show(); } }); $(".inpcon span").click(function(){ $(this).prev("input").focus(); }) $(".inpcon input.inp").focus(function(){ $(this).next("span").hide(); }).blur(function(){ if($(this).val()==''){ $(this).next("span").show(); } }) }else{ $(".inpcon span").hide(); } //网页高度 ah = $("#container").height(); // 初始化定位回到顶部连接 var w = document.body.clientwidth; if(w<=900){ $("#gotop").css("right","0"); }else{ var wr = math.ceil((w-900)/2-45); $("#gotop").css("right",wr+"px"); } // 监听滚动事件,判断是否显示回到顶部连接 var h,soltop; window.onscroll = function(){ if ((navigator.useragent.indexof('msie')>=0)&&(navigator.useragent.indexof('opera')<0)){ soltop = document.documentelement.scrolltop; }else if (navigator.useragent.indexof('firefox')>= 0){ soltop = document.documentelement.scrolltop; }else if (navigator.useragent.indexof('opera') >= 0){ soltop = document.documentelement.scrolltop; }else{ soltop = document.body.scrolltop; } h = document.documentelement.clientheight; if(soltop>=195){ $("#gotop").show(); }else{ $("#gotop").hide(); } }; //监听窗口尺寸 $(window).resize(function(){ if ((navigator.useragent.indexof('msie')>=0)&&(navigator.useragent.indexof('opera')<0)){ var www = document.documentelement.clientwidth;//显示器的显示区域的宽度 }else if (navigator.useragent.indexof('firefox')>= 0){ var www = document.documentelement.clientwidth;//显示器的显示区域的宽度 }else if (navigator.useragent.indexof('opera') >= 0){ var www = document.documentelement.clientwidth;//显示器的显示区域的宽度 }else{ var www = document.body.clientwidth; } $("#lc_lnk").css({"width":www+"px"});//设置控制条的宽度和位置 if(www<=900){ $("#gotop").css("right","0"); }else{ var wr = math.ceil((www-900)/2-45); $("#gotop").css("right",wr+"px"); } if(isshow==1){ www = document.documentelement.clientwidth;//显示器的显示区域的宽度 $("#lc_lnk").css({"width":www+"px"});//设置控制条的宽度和位置 lcbox(t); } }); $(".close").click(function(){ isshow=0;//释放弹出框初始值 $("#container").css({"height":ah+"px"});///释放界面高度值控制 $(".lc_img").css({"opacity":"0","filter":"alpha(opacity=0)"});//展示从右往左 return true; }) $(".closegboxy").click(function(){lcgboxy.hide();}) //刷新验证码 $("#ref_verify").click(function (){ $("#verify").attr('src',"../inc/verify.php?temp="+math.random()); return false; }); //递交表单 $("#subbtn").click(function(){ var name = $("#username").val(); var phone = $("#userphone").val(); var code = $("#usercode").val(); if(name!=''&&phone!=''){ $.post('../odm.php',{act:'save',username:name,userphone:phone,code:code},function(data){ if(data=='ok'){ alert("已成功留言!"); }else if(data=='error'){ alert("验证码不正确"); } }) }else{ alert('姓名和联系方式不能为空!'); } }) //full_height 后台管理页面左侧导航 高度全屏 $(".full_height").each(function(index, element){ var h = document.documentelement.clientheight-86;//显示器的显示区域的高度 $(this).css("height",h+'px'); }); }); //删除产品 function delpro(id){ var r = confirm("确认删除该产品吗?"); if(r){ $.post(site+'code.php',{act:'delpro',id:id},function(data){ if(data){ $("#prolistli_"+id).fadeout(); } }) } } //滑动到锚点 function sollmao(u){ $("html,body").animate({scrolltop:$("a[name="+u+"]").offset().top+"px"},{duration: 500,easing: "swing"}); return false; } //滚动条兼容问题 function _onscroll(){ var labeller_layer = document.getelementbyid('labeller_layer'); var scrolltop = document.documentelement.scrolltop + document.body.scrolltop; if(labeller_layer) labeller_layer.style.top = scrolltop + 'px'; }; //展示大图弹出框 function lcbox(v){ t=v; if(t=='lc'){imgw = 2400;}else{imgw = 2332;} wh = document.documentelement.clientheight;//显示器的显示区域的高度 var cwh = wh-45; $("#container").css({"height":cwh+"px","overflow":"hidden"});//取消页面轮动条 ww = document.documentelement.clientwidth;//显示器的显示区域的宽度 if(wh>=808){ th = math.ceil((wh-808)/2); sh = 808;//图片高度 sw = imgw;//容器宽度 }else{ sh = wh; th = math.ceil((wh-sh)/2); sw = math.ceil((sh/808)*imgw); } $(".lc_lnk").css({"width":ww+"px"});//设置控制条的宽度和位置 if(t=='cj'){$(".lc_lnk p").css({"width":"200px"});}else{$(".lc_lnk p").css({"width":"680px"});} $(".lc_img").css({"width":sw+"px","left":ww+"px"});//图片容器展示的宽度和位置 $(".lc_img img").css({"height":sh+"px"});//每张图片展示的宽度和位置 if(isshow==0){lcboxy = new boxy("."+t,{modal:true});} lcboxy.resize(ww,sh); lcboxy.moveto(0,th); if(isshow==0){ if(t=='lc'){ $(".lc_img").animate({left:"0","opacity":"1","filter":"alpha(opacity=100)"},1500 );//从右往左滑动展示 }else{ if(ww2 && n<=5){ $(".lc_img").animate({left:"-"+movel+"px"},800);//居中展示 }else{ if(ww3 && n<=4){ $(".lc_img").animate({left:"-"+movel+"px"},800);//居中展示 }else{ if(ww