loveorigami / yii2-scrollup-widget
Yii2 scrollup 小部件。围绕 Scrollup JQuery 插件的包装器
2.2
2017-02-03 10:32 UTC
Requires
- yiisoft/yii2: 2.*
This package is auto-updated.
Last update: 2024-09-21 20:33:24 UTC
README
围绕 "Scroll Up",一个 "轻量级 jQuery 插件,可以创建一个可定制的 "滚动到顶部" 功能,可以轻松地与任何网站一起使用。
查看 ScrollUp 演示页面 以查看插件演示,并不要忘记查看 scrollUp jQuery 插件首页。
安装
安装此扩展的首选方式是通过 composer。
安装,可以运行
$ php composer.phar require loveorigami/yii2-scrollup-widget "*"
或添加
"loveorigami/yii2-scrollup-widget": "*"
到您的 composer.json
文件的 require
部分。
使用方法
扩展安装后,只需在代码中通过
<?php use lo\widgets\scrollup\ScrollUp; ScrollUp::widget([ 'theme' => ScrollUp::THEME_IMAGE, 'themeDir' => '@path/to/our/theme', // if you want customization theme css file. 'options' => [ 'scrollText' => "To top", // Text for element 'scrollName'=> 'scrollUp', // Element ID 'topDistance'=> 400, // Distance from top before showing element (px) 'topSpeed'=> 3000, // Speed back to top (ms) 'animation' => ScrollUp::ANIMATION_SLIDE, // Fade, slide, none 'animationInSpeed' => 200, // Animation in speed (ms) 'animationOutSpeed'=> 200, // Animation out speed (ms) 'activeOverlay' => false, // Set CSS color to display scrollUp active point, e.g '#00FFFF' ] ]); ?>
使用即可。如果您想为滚动到顶部使用自己的样式,只需删除 'theme' 选项并提供所需的 CSS 样式。
有关插件选项和使用的更多信息,请参阅 scrollUp jQuery 插件首页。
许可证
loveorigami/yii2-scrollup-widget 根据 MIT 许可证发布。有关详细信息,请参阅捆绑的 LICENSE.md
。