(function(a){ a.a6={ //公共头部效果 headfn:function(){ //搜索 $('#search dl').hover(function(){ $(this).children('dd').stop().slidedown('fast') },function(){ $(this).children('dd').stop().slideup('fast') }) $('#search dd span').click(function(){ var val=$(this).text(); var oaction = $(this).attr("searchtype"); $(this).parents('dl').children('dt').children('span').text(val); $(this).parents('dl').children('dt').children('span').attr('searchtype',val); $(this).parents('dd').slideup('fast'); $('#searchtype').val(oaction); }); var $searchtype=$('#searchtype'); if($searchtype.val()!=''){ $('#search dd [searchtype='+$searchtype.val()+']').click() }else{ $('#search dd span').eq(0).click(); } //分站头部表单 seajs.use('/js/jquery.form.min',function(){ $('#headform').ajaxform({ beforesubmit:function(a,b,c){ var flag=null; $.each(a,function(i,d){ var tipname=$('[name='+d.name+']').data('tit'); if(d.value==''||d.value==tipname){ flag=true; alert(tipname+'不能为空3'); return false; }else if(d.name=='phone'){ if(!a6.validate.phone(d.value)){ flag=true; alert('手机号码格式不正确') return false } }else if(d.name=='area'){ if(!a6.validate.number(d.value)){ flag=true; alert(tipname+'请输入数字') return false } } }); if(flag){ $('input').each(function(index, element) { $(this).triggerhandler('blur'); }); return false; } }, success:function(d){ alert(json.stringify(d)) }, error:function(){ alert('error') } }) }); }, //获取验证码 getcode:function(obj){ var t=obj.innerhtml,n=60; (function(){ if(n>0){ obj.disabled=true obj.innerhtml='倒计时'+(n--)+'秒'; settimeout(arguments.callee,1000); }else{ obj.disabled=false; obj.innerhtml=t; } })(); }, //活动倒计时 countdown:function(opt){ // 1h = 3600 s // 1s = 1000 ms ;(function(){ var t=null; var stime=new date(opt.date); var mydate=new date(); var t=math.floor((stime-mydate)/1000); if(t<=0){ cleartimeout(t); opt.obj.html(opt.txt); return; } var d=math.floor(t/(3600*24)); var h=math.floor((t-d*24*3600)/3600); var m=math.floor((t/60)-(d*24*60+h*60)); var s=t%60; function setnum(d,t){ if(d==0){ return '' }else{ return d+t } } var html=setnum(d,'天')+setnum(h,'小时')+setnum(m,'分')+s+'秒'; opt.obj.html(html) t=settimeout(function(){a6.countdown(opt)},1000); })(); }, //手风琴特效 accordion:function(id){ $(id).mouseover(function(){ $(this).siblings().removeclass('active').end().addclass('active').find('img').lazyload(); }).eq(0).addclass('active').find('img').lazyload(); }, //验证规则 validate:{ required:function(e){ if(!e==''){ return true } return false }, email:function(e){ var reg=/^\w+@([0-9a-za-z]+[.])+[a-z]{2,4}$/; if(reg.test(e)){ return true } return false }, phone:function(e){ var reg=/^1[3|5|8|7]\d{9}$/; if(reg.test(e)){ return true } return false }, number:function(e){ if(!isnan(e)){ return true } return false }, idcard:function(e){ var reg=/(^\d{15}$)|(^\d{17}([0-9]|x|x)$)/; if(reg.test(e)){ return true } return false } }, //提交信息模块 submitinfo:function(id){ seajs.use('/js/plugins/jquery.form.min',function(){ $(id).ajaxform({ beforesubmit:function(a,b,c){ var flag=null; $.each(a,function(i,d){ var tipname=$('[name='+d.name+']').data('tit'); if((d.value==""&&d.name!='likestyle')||d.value==tipname){ flag=true; alert(tipname+'不能为空2'); return false; }else if(d.name=='phone'){ if(!a6.validate.phone(d.value)){ flag=true; alert('手机号码格式不正确') return false } }else if(d.name=='acreage'){ if(!a6.validate.number(d.value)){ flag=true; alert(tipname+'请输入数字') return false } } }); if(flag){ $('input').each(function(index, element) { $(this).triggerhandler('blur'); }); return false; } }, success:function(d){ alert(d.msg) $(id)[0].reset(); }, error:function(d){ alert(d.msg) } }) }); //滚动 var obj=$('#textscroll'); if(obj.find('li').length>5){ var d=setinterval(function(){ obj.children('li').eq(0).animate({height:0},'slow',function(){ obj.append($(this).removeattr('style')); }); },2000); } }, //底部计算器 counter:function(){ if($('#fixed-bottom-bar').length<=0){ $('body').append('
×

免费电话报价

400-6600-598

获取报价

'); // 获取风格偏好列表 a6.getstylelist('#likestyle-txt'); } seajs.use('/js/plugins/jquery.form.min',function(){ var flag=a6.cookie('down-bar'); var $bar=$('.fixed-bottom-box'); var $form=$('#fixed-bottom-form'); $form[0].reset();//刷新页面重置表单 //控制显示隐藏 function fn(){ if(flag){ return } var wint=$(window).scrolltop(); if(wint>100){ $bar.addclass('active'); }else{ $bar.removeclass('active'); } } $(window).on('scroll',fn); //关闭 $bar.find('.close').click(function(){ $bar.removeclass('active'); flag=1; a6.cookie('down-bar',1); }); //打开 $('.down-bar-btn').click(function () { $bar.addclass('active'); flag=false; a6.delcookie('down-bar'); }); //表单异步提交 }); }, //弹层 layer:function(opt){//二次封装 a6.luck.open({ content:'
'+opt.title+'
'+opt.content, callback:function(){ if(typeof opt.callback=='function'){ opt.callback(); } }, width:opt.width?opt.width:'auto', height:opt.height?opt.height:'auto', closebtn:true }) }, luck:{ view:function(d) { var t=d.content?d.content:''; //主框架 var luck = document.createelement("div"); luck.classname = "luck"; luck.id = "luck"; //内容容器 var con = document.createelement("div"); con.classname = "luck-con"; con.id = "luck-con"; if(d.width){ con.style.width=d.width; } if(d.height){ con.style.height=d.height; } con.innerhtml=t; //关闭按钮 var clo=document.createelement("div"); clo.classname='luck-close'; clo.onclick=a6.luck.close; //遮罩层 var oshade = document.createelement("div"); oshade.classname = "luck-shade"; oshade.onclick=a6.luck.close; //组合框架 if(d.closebtn){ con.appendchild(clo); } luck.appendchild(con); luck.appendchild(oshade); return luck; }, resize:function(){ var obj=document.getelementbyid('luck-con'); var t=((document.documentelement.clientheight||document.body.clientheight)/2-obj.offsetheight/2)+(document.body.scrolltop||document.documentelement.scrolltop) obj.style.top=(t>0?t:0)+'px'; }, open:function(t) { document.body.appendchild(a6.luck.view(t)); a6.luck.resize(); if(typeof t.callback=='function'){ t.callback(); } }, close:function() { var obj = document.getelementbyid("luck"); if(obj){ document.body.removechild(obj); } } }, slide:function(opt){ function fn(){ this.id=$(opt.id); this.len=this.id.find('img').length; this.num=0; this.speet=opt.speet?opt.speet:'slow'; this.auto=number(opt.auto); this.btn=opt.btn; this.flag=true; } fn.prototype.init=function(){ var _self=this,d; _self.page(); _self.id.find('img').one('trigger',function(){ $(this).attr({src:$(this).data('original')}); }).eq(0).trigger('trigger').eq(1).trigger('trigger'); _self.id.find('.slider-panel').eq(_self.num).css({zindex:1,display:'block'}); if(_self.auto){ d=setinterval(function(){ _self.next(); },_self.auto) } _self.id.mouseenter(function(){ clearinterval(d) }) _self.id.mouseleave(function(){ d=setinterval(function(){ _self.next(); },_self.auto) }); if(_self.btn){_self.showbtn()} } fn.prototype.next=function(){ var _self=this; _self.num++; _self.num=(_self.num==_self.len?0:_self.num); _self.showpic(_self.num); } fn.prototype.prev=function(){ var _self=this; _self.num--; _self.num=(_self.num<0?_self.len-1:_self.num); _self.showpic(_self.num); } fn.prototype.showpic=function(n){ var _self=this; if(_self.flag==false){return}//防止连续点击 _self.flag=false; _self.id.find('.slider-panel').eq(n).css({zindex:2}).stop().fadein(_self.speet,function(){ $(this).siblings().css({zindex:0,display:'none'}).end().css('z-index',1); _self.flag=true; }); _self.id.find('.slider-nav>li').eq(n).addclass('active').siblings().removeclass('active'); _self.id.find('img').eq(n).trigger('trigger'); var nextimg=_self.id.find('img').eq(n+1); if(nextimg){ nextimg.trigger('trigger'); } } fn.prototype.showbtn=function(){ var _self=this,btn="
"; _self.id.append(btn); _self.id.find('.slider-prev').click(function(){ _self.prev.call(_self) }); _self.id.find('.slider-next').click(function(){ _self.next.call(_self) }); } fn.prototype.page=function(){ var page=[],_self=this; page.push(''); _self.id.append(page.join('')); _self.id.find('.slider-nav').on('click','li',function(){ _self.showpic($(this).index()); }) } var fn=new fn(); fn.init(); }, cookie:function(c_name,value,expiredays,domain){ if(value){//设置cookie var exdate=new date() exdate.setdate(exdate.getdate()+expiredays) document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.togmtstring()) + ";path=/"+(domain?";domain="+domain:""); }else{//获取cookie if (document.cookie.length>0){ c_start=document.cookie.indexof(c_name + "=") if (c_start!=-1){ c_start=c_start + c_name.length+1 c_end=document.cookie.indexof(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" } }, delcookie:function(c_name){//删除cookie a6.cookie(c_name,'1',-1) }, getstylelist:function(id){ var html=''; $(id).append(html); } } }(window)); $(function(){ settimeout(function(){ //表单默认值处理 $('input[data-tit]').focus(function(){ if(this.value==$(this).data('tit')){ this.value=''; } }).blur(function(){ var tit=$(this).data('tit'); if(this.value==''){ this.value=tit; } }).each(function(i, e) { $(e).trigger('blur'); }); },500); $(".lazy").lazyload({ effect : "fadein", threshold:200 }); }); /* * lazy load - jquery plugin for lazy loading images * copyright (c) 2007-2013 mika tuupola * licensed under the mit license: * http://www.opensource.org/licenses/mit-license.php * project home: * http://www.appelsiini.net/projects/lazyload * version: 1.8.5 */ !function(e,t,o,n){var i=e(t);e.fn.lazyload=function(r){function f(){var t=0;a.each(function(){var o=e(this);if(!d.skip_invisible||o.is(":visible"))if(e.abovethetop(this,d)||e.leftofbegin(this,d));else if(e.belowthefold(this,d)||e.rightoffold(this,d)){if(++t>d.failure_limit)return!1}else o.trigger("appear"),t=0})}var l,a=this,d={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return r&&(n!==r.failurelimit&&(r.failure_limit=r.failurelimit,delete r.failurelimit),n!==r.effectspeed&&(r.effect_speed=r.effectspeed,delete r.effectspeed),e.extend(d,r)),l=d.container===n||d.container===t?i:e(d.container),0===d.event.indexof("scroll")&&l.bind(d.event,function(){return f()}),this.each(function(){var t=this,o=e(t);t.loaded=!1,o.one("appear",function(){if(!this.loaded){if(d.appear){var n=a.length;d.appear.call(t,n,d)}e("").bind("load",function(){o.hide().attr("src",o.data(d.data_attribute))[d.effect](d.effect_speed),t.loaded=!0;var n=e.grep(a,function(e){return!e.loaded});if(a=e(n),d.load){var i=a.length;d.load.call(t,i,d)}}).attr("src",o.data(d.data_attribute))}}),0!==d.event.indexof("scroll")&&o.bind(d.event,function(){t.loaded||o.trigger("appear")})}),i.bind("resize",function(){f()}),/iphone|ipod|ipad.*os 5/gi.test(navigator.appversion)&&i.bind("pageshow",function(t){t.originalevent&&t.originalevent.persisted&&a.each(function(){e(this).trigger("appear")})}),e(o).ready(function(){f()}),this},e.belowthefold=function(o,r){var f;return f=r.container===n||r.container===t?i.height()+i.scrolltop():e(r.container).offset().top+e(r.container).height(),f<=e(o).offset().top-r.threshold},e.rightoffold=function(o,r){var f;return f=r.container===n||r.container===t?i.width()+i.scrollleft():e(r.container).offset().left+e(r.container).width(),f<=e(o).offset().left-r.threshold},e.abovethetop=function(o,r){var f;return f=r.container===n||r.container===t?i.scrolltop():e(r.container).offset().top,f>=e(o).offset().top+r.threshold+e(o).height()},e.leftofbegin=function(o,r){var f;return f=r.container===n||r.container===t?i.scrollleft():e(r.container).offset().left,f>=e(o).offset().left+r.threshold+e(o).width()},e.inviewport=function(t,o){return!(e.rightoffold(t,o)||e.leftofbegin(t,o)||e.belowthefold(t,o)||e.abovethetop(t,o))},e.extend(e.expr[":"],{"below-the-fold":function(t){return e.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return e.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!e.rightoffold(t,{threshold:0})},"in-viewport":function(t){return e.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return e.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!e.rightoffold(t,{threshold:0})}})}(jquery,window,document);