count tps
This commit is contained in:
parent
252fd5a124
commit
652b6c9f76
|
|
@ -489,5 +489,24 @@ className: 'user-location'
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll(".counter").forEach(el => {
|
||||
const target = +el.dataset.target;
|
||||
let val = 0;
|
||||
|
||||
const step = () => {
|
||||
val += Math.ceil(target / 90);
|
||||
if (val < target) {
|
||||
el.textContent = val;
|
||||
requestAnimationFrame(step);
|
||||
} else {
|
||||
el.textContent = target;
|
||||
}
|
||||
};
|
||||
step();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</section>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Reference in New Issue