(function(d){var r=function(b){return b.split("").reverse().join("")},m={numberstep:function(b,a){var e=math.floor(b);d(a.elem).text(e)}},g=function(b){var a=b.elem;a.nodetype&&a.parentnode&&(a=a._animatenumbersetter,a||(a=m.numberstep),a(b.now,b))};d.tween&&d.tween.prophooks?d.tween.prophooks.number={set:g}:d.fx.step.number=g;d.animatenumber={numberstepfactories:{append:function(b){return function(a,e){var f=math.floor(a);d(e.elem).prop("number",a).text(f+b)}},separator:function(b,a,e){b=b||" "; a=a||3;e=e||"";return function(f,k){var u=0>f,c=math.floor((u?-1:1)*f).tostring(),n=d(k.elem);if(c.length>a){for(var h=c,l=a,m=h.split("").reverse(),c=[],p,s,q,t=0,g=math.ceil(h.length/l);t 1100) { $('#dowebok').fullpage({ verticalcentered: !1, navigation: !0, afterrender: function (index) { // 加载wow动画 wow = new wow({ animateclass: 'animated', }); wow.init(); $(".mouse").click(function () { $.fn.fullpage.movesectiondown(); }); }, onleave: function (prev, index, direction) { // $("#dowebok .section").eq(index - 1).find('.wow').each(function () { if ($(this).attr('data-wow-delay')) { $(this).attr('style', 'animation-delay:' + $(this).attr('data-wow-delay')) } else { $(this).attr('style', '') }; }); $("#dowebok .section").eq(index - 1).find('.wow').addclass('animated'); // 结束 console.log(index,'index') if(index==2){ countcx(); } } }) $('.stock-fixed .stock-numbox').mousemove(function (){ $('.stock-fixed .stock-box').fadein(1000); }) $('.stock-fixed .stock-numbox').mouseleave(function (){ $('.stock-fixed .stock-box').fadeout(1000); }) } var bannerswiper = new swiper('.banner .swiper-container', { speed: 1600, autoplay: { delay: 10000, disableoninteraction: true, }, pagination: { el: '.swiper-pagination', clickable :true, }, navigation: { nextel: '.banner .swiper-button-next', prevel: '.banner .swiper-button-prev', }, effect: "fade", on: { init: function (swiper) { swiperanimatecache(this); swiperanimate(this); var len = $(".banner .swiper-slide ").length; var total = len<10 ? '0' +len:len var active =(swiper.activeindex+1)<10 ? '0' +(swiper.activeindex+1):(swiper.activeindex+1); $(".swiper-num .active").text(active); $(".swiper-num .total").text(total); }, slidechange: function (swiper) { swiperanimate(this); var active =(swiper.realindex +1)<10 ? '0'+(swiper.realindex +1):(swiper.realindex +1); $(".swiper-num .active").text(active); } }, }) function getstock(){ function aninumber(id,value,decimal,unit){ //id,滚动值,保留小数位,单位 $(id).animatenumber({ number: value*decimal, easing:'easeoutquad', numberstep:function(now,tween){ var floored_number = math.floor(now) / decimal, target = $(tween.elem); if(unit){ target.text(floored_number+unit); }else{ target.text(floored_number); } }, },1800); } var source_ele = v_sz300080.split("~"); console.log(source_ele[31],'source_ele[31]') if(source_ele[31]<0){ $(".xj").addclass("down"); }else{ $(".xj").removeclass("down"); } aninumber("#xj",source_ele[3],100);//现金价值 aninumber("#zg",source_ele[33],100);//最高 aninumber("#zd",source_ele[34],100,);//最低 aninumber("#cjl",source_ele[36],1);//成交量 aninumber("#cje",source_ele[37],1);//成交额 aninumber("#bl1",source_ele[31],100);// aninumber("#bl2",source_ele[32],100,'%');// // aninumber("#time",source_ele[30],1);// console.log(source_ele[30],'source_ele[30]') var numbers = source_ele[30]; let position1 = 4; let position2 = 6; let position3 = 8; let position4 = 10; let position5 = 12; let character = "-"; let character2 = ":"; let result = numbers.slice(0, position1) + character + numbers.slice(position1, position2) + character + numbers.slice(position2, position3) + ' ' + numbers.slice(position3,position4) + character2 + numbers.slice(position4,position5) + character2 + numbers.slice(position5); console.log(result,'result') document.getelementbyid("time").innertext = result; }; getstock(); setinterval(getstock,20000); var countcxarr = []; var countcx = function() { $('.numcount').each(function(i, dom) { if (countcxarr[i] && countcxarr[i] === true) { return; } var st; var nctop; st = $(window).scrolltop(); nctop = $(dom).offset().top; console.log( st,'st') console.log( dom,'dom') console.log( nctop,'nctop') console.log( $(window).height(),'$(window).height()') console.log($('.sec02').offset().top,'sec02') var id, decimals, startval, endval, duration; $(dom).find('.numcx').each(function() { id = $(this).attr('id'); decimals = $(this).attr('data-decimals'), startval = $(this).attr('data-startval'), endval = $(this).attr('data-endval'), duration = $(this).attr('data-speed'); new countup(id, startval, endval, decimals, duration, { useeasing: true, //效果 separator: '' //数字分隔符 }).start(); // target:目标元素id, // startval: 你想要开始的值, endval: 你想要到达的值, decimals: 小数位数, 默认值为0, duration: 动画持续时间为秒, 默认值为2, options: 选项的可选对象 countcxarr[i] = true; }) // if (st > nctop - $(window).height() && st < nctop) { // if (st < nctop) { // $(dom).find('.numcx').each(function() { // id = $(this).attr('id'); // decimals = $(this).attr('data-decimals'), startval = $(this).attr('data-startval'), endval = $(this).attr('data-endval'), duration = $(this).attr('data-speed'); // new countup(id, startval, endval, decimals, duration, { // useeasing: true, //效果 // separator: '' //数字分隔符 // }).start(); // // target:目标元素id, // // startval: 你想要开始的值, endval: 你想要到达的值, decimals: 小数位数, 默认值为0, duration: 动画持续时间为秒, 默认值为2, options: 选项的可选对象 countcxarr[i] = true; // }) // } }) } countcx(); if (w_width <= 1100){ $(window).on("scroll", function() { console.log($('.sec02').offset().top,'sec02') st = $(window).scrolltop(); nctop = $('.sec02').offset().top; if (st > nctop - $(window).height() && st < nctop) { countcx(); } }) } })