SHOW:
|
|
- or go back to the newest paste.
| 1 | function countUp(count) | |
| 2 | {
| |
| 3 | var div_by = 100, | |
| 4 | speed = Math.round(count / div_by), | |
| 5 | $display = $('.count'),
| |
| 6 | run_count = 1, | |
| 7 | int_speed = 24; | |
| 8 | ||
| 9 | var int = setInterval(function() {
| |
| 10 | if(run_count < div_by){
| |
| 11 | $display.text(speed * run_count); | |
| 12 | run_count++; | |
| 13 | } else if(parseInt($display.text()) < count) {
| |
| 14 | var curr_count = parseInt($display.text()) + 1; | |
| 15 | $display.text(curr_count); | |
| 16 | } else {
| |
| 17 | clearInterval(int); | |
| 18 | } | |
| 19 | }, int_speed); | |
| 20 | } | |
| 21 | ||
| 22 | - | countUp(495); |
| 22 | + | countUp(<?php |
| 23 | $sql="select count(id) total from users"; | |
| 24 | $row=$mysqli->query($sql)->->fetch_assoc(); | |
| 25 | //495 | |
| 26 | echo $row['total']; | |
| 27 | ?>); | |
| 28 | ||
| 29 | function countUp2(count) | |
| 30 | {
| |
| 31 | var div_by = 100, | |
| 32 | speed = Math.round(count / div_by), | |
| 33 | $display = $('.count2'),
| |
| 34 | run_count = 1, | |
| 35 | int_speed = 24; | |
| 36 | ||
| 37 | var int = setInterval(function() {
| |
| 38 | if(run_count < div_by){
| |
| 39 | $display.text(speed * run_count); | |
| 40 | run_count++; | |
| 41 | } else if(parseInt($display.text()) < count) {
| |
| 42 | var curr_count = parseInt($display.text()) + 1; | |
| 43 | $display.text(curr_count); | |
| 44 | } else {
| |
| 45 | clearInterval(int); | |
| 46 | } | |
| 47 | }, int_speed); | |
| 48 | } | |
| 49 | ||
| 50 | countUp2(947); | |
| 51 | ||
| 52 | function countUp3(count) | |
| 53 | {
| |
| 54 | var div_by = 100, | |
| 55 | speed = Math.round(count / div_by), | |
| 56 | $display = $('.count3'),
| |
| 57 | run_count = 1, | |
| 58 | int_speed = 24; | |
| 59 | ||
| 60 | var int = setInterval(function() {
| |
| 61 | if(run_count < div_by){
| |
| 62 | $display.text(speed * run_count); | |
| 63 | run_count++; | |
| 64 | } else if(parseInt($display.text()) < count) {
| |
| 65 | var curr_count = parseInt($display.text()) + 1; | |
| 66 | $display.text(curr_count); | |
| 67 | } else {
| |
| 68 | clearInterval(int); | |
| 69 | } | |
| 70 | }, int_speed); | |
| 71 | } | |
| 72 | ||
| 73 | countUp3(328); | |
| 74 | ||
| 75 | function countUp4(count) | |
| 76 | {
| |
| 77 | var div_by = 100, | |
| 78 | speed = Math.round(count / div_by), | |
| 79 | $display = $('.count4'),
| |
| 80 | run_count = 1, | |
| 81 | int_speed = 24; | |
| 82 | ||
| 83 | var int = setInterval(function() {
| |
| 84 | if(run_count < div_by){
| |
| 85 | $display.text(speed * run_count); | |
| 86 | run_count++; | |
| 87 | } else if(parseInt($display.text()) < count) {
| |
| 88 | var curr_count = parseInt($display.text()) + 1; | |
| 89 | $display.text(curr_count); | |
| 90 | } else {
| |
| 91 | clearInterval(int); | |
| 92 | } | |
| 93 | }, int_speed); | |
| 94 | } | |
| 95 | ||
| 96 | countUp4(10328); |