-
Notifications
You must be signed in to change notification settings - Fork 7
/
ScrollTop.php
54 lines (49 loc) · 1.21 KB
/
ScrollTop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @link https://github.com/bluezed/yii2-scroll-top
* @copyright Copyright (c) 2015 Thomas Geppert
* @license https://github.com/bluezed/yii2-scroll-top/blob/master/LICENSE
*/
namespace bluezed\scrollTop;
use yii\helpers\Json;
use yii\base\Widget;
use yii\helpers\Html;
/**
* scroll-to-top widget to include in a website
*
* @author Thomas Geppert <[email protected]>
*/
class ScrollTop extends Widget
{
public $i_class;
public $a_class;
/**
* @inheritdoc
*/
public function init()
{
if($this->i_class === null){
$this->i_class = 'glyphicon glyphicon-menu-up bluezed-scroll-top-circle';
}
if($this->a_class === null){
$this->a_class = 'bluezed-scroll-top';
}
$view = $this->getView();
ScrollTopAsset::register($view);
}
/**
* @inheritdoc
*/
public function run()
{
return Html::a(
Html::tag(
'i',
'',
['class'=> $this->i_class]
),
'#',
['id'=>'btn-top-scroller', 'class'=> $this->a_class]
);
}
}