| 1: | <?php
|
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: |
|
| 19: |
|
| 20: |
|
| 21: |
|
| 22: | class Counter extends Sphp\tools\Component{
|
| 23: | protected function oncreate($element){
|
| 24: | $this->setHTMLName("");
|
| 25: | }
|
| 26: |
|
| 27: | protected function onjsrender(){
|
| 28: | addFileLink($this->myrespath . '/res/jquery.appear.min.js');
|
| 29: | addFileLink($this->myrespath . '/res/counter-up.js');
|
| 30: | $this->element->appendAttribute('class', 'counter');
|
| 31: | if(!$this->element->hasAttribute('data-count')) $this->setAttribute('data-count', '+');
|
| 32: | if(!$this->element->hasAttribute('data-to')) $this->setAttribute('data-to', '500');
|
| 33: | if(!$this->element->hasAttribute('data-speed')) $this->setAttribute('data-speed', '3000');
|
| 34: |
|
| 35: | addHeaderJSFunctionCode('ready','counter1','
|
| 36: | $(".counter").countTo();
|
| 37: | $(".counter-box").appear(
|
| 38: | function () {
|
| 39: | $(".counter").countTo();
|
| 40: | },
|
| 41: | { accY: -100 }
|
| 42: | );
|
| 43: |
|
| 44: | ');
|
| 45: |
|
| 46: | }
|
| 47: |
|
| 48: |
|
| 49: | } |