dev-master
9999999-devA simple widget button to use to go back to the top of the page
MIT
The Requires
by walter cosentino
extension yii2 widget back2top
A simple widget button to use to go back to the top of the page
A simple widget button to use to go back to the top of the page, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist walter74/yii2-back2top "*"
or add, (*4)
"walter74/yii2-back2top": "*"
to the require section of your composer.json
file., (*5)
Once the extension is installed, simply use it in your code by :, (*6)
<?= \walter74\back2top\Back2Top::widget(); ?>
You can configure several custom attributes which are set by default as follow :, (*7)
'id' =>"toTop" 'class_tag' => 'btn btn-info' 'style_tag'=>'display: block;' 'position_bottom'=>'100px;' 'position_right'=>'10px;' 'title=>'Back To Top' 'class_icon'=>'glyphicon glyphicon-chevron-up' 'template'=>'<div id="{{id_widget}}" class="{{class_tag}}" style="{{style_tag}}"><span class="{{class_icon}}"></span>{{title}}</div>'
if you want to change these settings, you've to pass new value by widget config as the example showed below:, (*8)
<?= \walter74\back2top\Back2Top::widget(['title'=>'go up','class_icon'=>'glyphicon glyphicon-arrow-up']); ?>
it's possible even to inject your custom code or style rather than the default configuration, by passing through js and css respectevely since both two are set as null by default:
js=>null
css=>null
, (*9)
Once you've modified the code, new code will be registered as init() function will be called., (*10)
A simple widget button to use to go back to the top of the page
MIT
extension yii2 widget back2top