settimeout(function () { document.queryselector('body').style.opacity = '1' },20) var aos = { init: function(e) { var allaos = document.queryselectorall('*[aos]') for (let i = 0; i < allaos.length; i++) { document.body.clientwidth > e.mobile ? perform() : execution() function perform() { allaos[i].classlist.add('aos-init') var offset = (allaos[i].getboundingclientrect().top + window.pageyoffset) - document.documentelement.clientheight if (offset < e.scroll) { allaos[i].classlist.add('aos-animate') } else { allaos[i].classlist.remove('aos-animate') } } function execution() { allaos[i].removeattribute('aos') allaos[i].removeattribute('aos-delay') } } } } function scroll_start(e) { e.foreach((ele)=>{ var smooth = ele.smooth, target = ele.target, start = ele.start, end = ele.end, direction = ele.direction; if (direction === 'x') { if (smooth > start && smooth < end) { $(target).css('transform', 'translatex(' + (smooth - start) + 'px)') } else if (smooth <= start) { $(target).css('transform', 'translatex(0px)') } }else if (direction === 'xy'){ if (smooth > start && smooth < end) { $(target).css('transform', 'translate('+ (smooth - start) +'px,'+ (smooth - start) +'px)') } else if (smooth <= start) { $(target).css('transform', 'translate(0px)') } } else if (smooth >= end) { $(target).css('transform', 'translate(0,'+ end +'px)') } else { if (smooth > start && smooth < end) { $(target).css('transform', 'translate(0 , ' + (smooth - start) + 'px)') } else if (smooth <= start) { $(target).css('transform', 'translate(0px)') } } }) } $('.text_effect').each(function (index,ele) { var ly = $(ele).data('delay'); if (ly === undefined) { ly = 20; } var text = $(ele).find('.appoint').text(); var html = ''; for(var i=0;i'; } $(ele).find('.appoint').html('
'+html+'
'+html+'
'); $(ele).find('.fist').each(function (i,e) { $(e).find('div').each(function (i,e) { var delay = i*ly; $(e).css({ 'transition': '900ms cubic-bezier(.19,1,.22,1) '+ delay +'ms' }) }) }) }) // text_effect2 start const dom = {}; dom.enter = document.queryselectorall('.text_effect2 .appoint'); for (let i = 0; i < dom.enter.length; i++) { function rgbtohex(rgb) { var rgbvalues = rgb.match(/\d+/g); var hexcolor = '#' + rgbvalues.map(function (value) { var hex = parseint(value).tostring(16); return hex.length === 1 ? '0' + hex : hex; }).join(''); return hexcolor; } dom.enter.foreach(element => { const text = element.textcontent; element.innerhtml = ''; for (const char of text) { const charspan = document.createelement('span'); charspan.textcontent = char; element.appendchild(charspan); } }); dom.enter[i].addeventlistener('mouseenter', function () { var span = dom.enter[i].queryselectorall('span'); var data_color = dom.enter[i].getattribute('data-color') anime.remove(span); anime({ targets: span, delay: (t, i) => i * 7, translatey: [ {value: 10, duration: 150, easing: 'easeinquad'}, {value: [-10, 0], duration: 150, easing: 'easeoutquad'} ], opacity: [ {value: 0, duration: 150, easing: 'linear'}, {value: 1, duration: 150, easing: 'linear'} ], color: { value: data_color, duration: 1, delay: (t, i, l) => i * 7 + 150 } }); }); dom.enter[i].addeventlistener('mouseleave', function () { var span = dom.enter[i].queryselectorall('span'); var color_ = window.getcomputedstyle(dom.enter[i]).color; var hexcolor = rgbtohex(color_); anime.remove(span); anime({ targets: span, delay: (t, i, l) => (l - i - 1) * 7, translatey: [ {value: 10, duration: 150, easing: 'easeinquad'}, {value: [-10, 0], duration: 150, easing: 'easeoutquad'} ], opacity: [ {value: 0, duration: 150, easing: 'linear'}, {value: 1, duration: 150, easing: 'linear'} ], color: { value: hexcolor, duration: 1, delay: (t, i, l) => (l - i - 1) * 7 + 150 } }); }); } // text_effect2 end $('.down_select').each(function(i,e) { $(e).find('.pull div').append('') if ($(e).is('.active')) { $(e).find('.pull').prepend('
璇烽€夋嫨
') } $(e).click(function (e) { $(this).toggleclass('on').siblings().removeclass('on') e.stoppropagation() }) $(e).find('.pull div').click(function (e) { var text = $(this).text() $(this).addclass('on').siblings().removeclass('on') $(this).parents('.down_select').find('.txt').text(text) $('.down_select').removeclass('on') e.stoppropagation() }) $(e).find('.pull div span').css('background-color',$(e).attr('data-color')) }) $('body').click(function () { $('.down_select').removeclass('on') }) const countitems = document.queryselectorall('.count-item'); function onintersection(entries, observer) { entries.foreach(entry => { if (entry.isintersecting) { const e = entry.target; animatecount(e); // observer.unobserve(e); } }); } const observer = new intersectionobserver(onintersection); countitems.foreach(item => observer.observe(item)); function animatecount(e) { var demo = { score: 0 }, scoredisplay = e, to = e.getattribute('data-to'), speed = e.getattribute('data-speed') * 1, separator = e.getattribute('data-separator'), to_fixed = e.getattribute('data-fixed'); if (to !== null) { if (to.indexof('.') !== -1) { var automatic = (to.length -1)-to.indexof('.') } } if (speed === 0) { speed = 1; } tweenlite.to(demo, speed, { score: to, onupdate: showscore }); function showscore() { if (separator !== null) { scoredisplay.innerhtml = formatnumberwithcommasanddecimal(demo.score, to_fixed, separator); }else if (to_fixed !== null) { scoredisplay.innerhtml = demo.score.tofixed(automatic); }else { scoredisplay.innerhtml = demo.score.tofixed(0); } } } function formatnumberwithcommasanddecimal(number, decimalplaces,separator) { var formattednumber = number.tofixed(decimalplaces); formattednumber = formattednumber.replace(/\b(?=(\d{3})+(?!\d))/g, separator); return formattednumber; } $('video:not(video[muted])').trigger('pause') function video_alert(e) { var alert = $('.alert_video') var video = $('.alert_video .joke .video video') var controls = $(e).find('video').attr('controls') var loop = $(e).find('video').attr('loop') $(video).attr('controls',controls) $(video).attr('loop',loop) $(alert).addclass('video_active') $(video).attr('src',$(e).find('video').attr('src')) $(video).trigger('play'); if ($(e).is('.all')) { $(alert).addclass('all') }else { $(alert).removeclass('all') } } function video_close() { $('.alert_video').removeclass('video_active') $('.alert_video .joke .video video').trigger('pause'); $('.alert_video .joke .item').removeclass('item_active') } $(document).on('click','.alert_video .joke .close',function () { video_close() }) $(document).on('click','.alert_video .mask',function () { video_close() }) var video_html = ''; video_html+= `
` if ($('*[onclick*="video_alert(this)"] video').length > 0) { $('body').append(video_html) } var public_text = ''; public_text += `

` function alert_text(e) { $('html').append(public_text) if ($(e).is('.correct')) { $('.alert_text').addclass('correct').removeclass('error') }else if ($(e).is('.error')) { $('.alert_text').addclass('error').removeclass('correct') } var obj = $(e).find('.txt').text() var background = $(e).attr('data-background') var color = $(e).attr('data-color') if (obj !== '') { $('.alert_text p').text(obj) }else { $('.alert_text p').text(e.text) $('.alert_text').addclass(e.class) } $('.alert_text').each(function (index,ele) { var top = index * 60 + 60 if (obj !== '') { $(ele).css({ 'top': top + 'px', 'background-color': background, }) $(ele).find('p').css({ 'color': color }) }else { $(ele).css({ 'top': top + 'px', 'background-color': e.background, }) $(ele).find('p').css({ 'color': e.color }) } settimeout(function () { $(ele).removeclass('fadeinup_').addclass('fadeoutdown_') settimeout(function () { $(ele).remove() },800) },2000) }) setinterval(function () { $('.alert_text').each(function (index,ele) { var top = index * 60 + 60 $(ele).css({ 'top': top + 'px', }) }) },2800) } // $('h1').click(function () { // alert_text({ // text:'杩欐槸涓€涓彁绀?, // class: 'error', // // background: '#ff0000', // // color: '#fff', // }) // }) //