$(function(){ var myswiper = new swiper(".bannerd",{ effect : 'fade', loop:true, pagination:'.swiper-pagination', nextbutton: '.swiper-button-next', prevbutton: '.swiper-button-prev', paginationclickable: true, spacebetween: 0, centeredslides: true, autoplay: 5000, autoplaydisableoninteraction: false, preventclicks:false }); $('.tjxw').owlcarousel({ animateout: 'fadeout', animatein: 'fadein', loop:false, autoplay:false, dots:false, autoplayhoverpause:false, mousedrag:false, nav:false, items: 1, autoplaytimeout:4000, }); }); $('.proc1,.proc2,.proc3').owlcarousel({ rtl: true, loop:true, margin:20, autoplay:true, dots:true, nav:false, autoplayhoverpause:true, autoheight: false, autoplaytimeout:2500, responsive:{ 0:{ dots:true, nav:false, margin:10, items:2 }, 350:{ margin:10, items:2 }, 500:{ items:3, }, 1150:{ nav:true, dots:false, items:4 } } }); /*数字变幻*/ (function($){$.fn.countto=function(opts){var options=$.extend({},$.fn.countto.defaults,opts);return $(this).each(function(){var _this=this,originaldata=$(this).text(),loops=math.ceil(options.speed/options.refreshinterval),increment=($(this).text()-options.from)/loops,loopcount=0,value=options.from,interval=setinterval(updatetimer,options.refreshinterval);function updatetimer(){value+=increment;loopcount++;var str=value.tofixed(options.decimals);this.sizenum=str.length;this.sizenumbefore=this.sizenum-options.decimals-1;if(this.sizenumbefore>=options.beforesize){$(_this).html(str+options.lastsymbol);}else{this._str=array(options.beforesize-this.sizenumbefore+1).join('0')+str;$(_this).html(this._str+options.lastsymbol);} if(typeof(options.onupdate)=='function'){options.onupdate.call(_this,value,loopcount);} if(loopcount>=loops){clearinterval(interval);$(_this).html(originaldata+options.lastsymbol);value=$(_this).text();if(typeof(options.oncomplete)=='function'){options.oncomplete(value,loopcount,_this);}}}});};$.fn.countto.defaults={lastsymbol:"%",from:0,speed:1000,refreshinterval:100,beforesize:0,decimals:0,onupdate:null,oncomplete:null};})(jquery); var n_flag; $(window).scroll(function(){ if($(window).scrolltop()>=$('#part2').position().top-150){ if(n_flag==0){ $(".timer1").countto({ lastsymbol:"", //显示在最后的字符 from: 0, // 开始时的数字 speed: 1000, // 总时间 refreshinterval:40, // 刷新一次的时间 beforesize:0, //小数点前最小显示位数,不足的话用0代替 decimals: 0, // 小数点后的位数,小数做四舍五入 onupdate: function() { }, // 更新时回调函数 oncomplete: function() { for(i in arguments){ //console.log(arguments[i]); } } }); n_flag=1; } } if($(window).scrolltop()<=$('#part2').position().top-150){ n_flag=0; } });