الگو:کادر-شمارنده: تفاوت میان نسخهها
جزبدون خلاصۀ ویرایش برچسب: ویرایش مبدأ ۲۰۱۷ |
جزبدون خلاصۀ ویرایش برچسب: ویرایش مبدأ ۲۰۱۷ |
||
| خط ۱: | خط ۱: | ||
<div id="counter" style="font-size: | <div style="width:160px; border:1px solid #ccc; padding:10px; text-align:center; border-radius:8px; font-family:Tahoma;"> | ||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Icon_example.png/40px-Icon_example.png" alt="آیکن" style="margin-bottom:8px;" /> | |||
<div style="font-weight:bold; font-size:16px;">تعداد آیتمها</div> | |||
<div id="animated-counter" style="font-size:20px; color:#333; margin-top:6px;">1</div> | |||
</div> | |||
<script> | <script> | ||
let count = 1; | let count = 1; | ||
const max = 67; | const max = 67; | ||
const speed = | const speed = 40; // سرعت شمارش (میلیثانیه) | ||
const counter = document.getElementById("animated-counter"); | |||
const | |||
const interval = setInterval(() => { | const interval = setInterval(() => { | ||
count++; | count++; | ||
if (count > max) | counter.textContent = count; | ||
if (count >= max) clearInterval(interval); | |||
}, speed); | }, speed); | ||
</script> | </script> | ||
نسخهٔ ۶ سپتامبر ۲۰۲۵، ساعت ۲۰:۴۴
<img src="" alt="آیکن" style="margin-bottom:8px;" />
تعداد آیتمها
1
<script>
let count = 1;
const max = 67;
const speed = 40; // سرعت شمارش (میلیثانیه)
const counter = document.getElementById("animated-counter");
const interval = setInterval(() => {
count++;
counter.textContent = count;
if (count >= max) clearInterval(interval);
}, speed);
</script>