Category : viewport

Here is my implementation of counters using javascript on AMP page: Frontend Screenshot: JS: <script id="counter-async" type="text/plain" target="amp-script"> const obj = document.querySelector(‘.counter-wrap’); let cDataEnd = obj.getAttribute(‘data-cend’); function animateValue(obj, start, end, duration) { let startTimestamp = null; const step = (timestamp) => { if (!startTimestamp) startTimestamp = timestamp; const progress = Math.min((timestamp – startTimestamp) / duration, ..

Read more