Skip to content

Commit 4de4262

Browse files
authored
Merge pull request #5 from rymedia/dev-ry
Customization option
2 parents 0164d15 + 6c737d1 commit 4de4262

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Add this line to your main layout so the widget gets loaded automatically into e
2929
<?= \bluezed\scrollTop\ScrollTop::widget() ?>
3030
```
3131

32+
To customize the class of the i and a-tags generated by the widget use the following syntax:
33+
```php
34+
<?= \bluezed\scrollTop\ScrollTop::widget([
35+
'i_class' => 'glyphicon glyphicon-menu-up bluezed-scroll-top-circle my_custom_class',
36+
'a_class' => 'bluezed-scroll-top my_other_custom_class') ?>
37+
```
38+
39+
3240
By default your main layout should be located here:
3341
```
3442
<Project-Folder>/views/layouts/main.php

ScrollTop.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,21 @@
1818
*/
1919
class ScrollTop extends Widget
2020
{
21+
public $i_class;
22+
public $a_class;
23+
2124
/**
2225
* @inheritdoc
2326
*/
2427
public function init()
2528
{
29+
if($this->i_class === null){
30+
$this->i_class = 'glyphicon glyphicon-menu-up bluezed-scroll-top-circle';
31+
}
32+
if($this->a_class === null){
33+
$this->a_class = 'bluezed-scroll-top';
34+
}
35+
2636
$view = $this->getView();
2737
ScrollTopAsset::register($view);
2838
}
@@ -35,10 +45,10 @@ public function run()
3545
Html::tag(
3646
'i',
3747
'',
38-
['class'=>'glyphicon glyphicon-menu-up bluezed-scroll-top-circle']
48+
['class'=> $this->i_class]
3949
),
4050
'#',
41-
['id'=>'btn-top-scroller', 'class'=>'bluezed-scroll-top']
51+
['id'=>'btn-top-scroller', 'class'=> $this->a_class]
4252
);
4353
}
44-
}
54+
}

0 commit comments

Comments
 (0)