GitHub: https://github.com/oonne/yii2-scroll-to-top.
yii2-scroll-to-top
A Yii2 widget to add scroll-to-top button. Base on the .animate jQuery function.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist oonne/yii2-scroll-to-top "*"
or add
"oonne/yii2-scroll-to-top": "*"
to the require section of your composer.json
file.
Usage
<?= \oonne\scrollTop\ScrollTop::widget() ?>
<?php use oonne\scrollTop\ScrollTop; ?>
<?= ScrollTop::widget([
'options' => 'custom-css class-name'
]); ?>
<?php use oonne\scrollTop\ScrollTop; ?>
<?= ScrollTop::widget([
'tagContent' => '<i class="top-icon"></i>',
'options' => 'custom-css class-name',
]); ?>
中文文档
简介
Yii2 回到顶部按钮,基于jQuery的animate,支持自定义内容和样式。
安装
通过 composer 进行安装。
执行以下命令:
php composer.phar require --prefer-dist oonne/yii2-scroll-to-top "*"
或把以下内容添加到composer.json中:
"oonne/yii2-scroll-to-top": "*"
使用
基础用法:
<?= \oonne\scrollTop\ScrollTop::widget() ?>
自定义样式:
<?php use oonne\scrollTop\ScrollTop; ?>
<?= ScrollTop::widget([
'options' => 'custom-css class-name'
]); ?>
自定义内容和样式:
<?php use oonne\scrollTop\ScrollTop; ?>
<?= ScrollTop::widget([
'tagContent' => '<i class="top-icon"></i>',
'options' => 'custom-css class-name',
]); ?>