grptx / yii2-smooth-scroll
Smooth Scroll widget for Yii2
Installs: 224
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-widget
Requires
- bower-asset/smooth-scroll.js: *
- yiisoft/yii2: *
README
Smooth Scroll component for Yii2 based on Smooth Scroll library
Install
Preferred way to install is through Composer:
php composer.phar require grptx/yii2-smooth-scroll:^1
Or, you may add
"grptx/yii2-smooth-scroll": "^1"
to the require section of your composer.json
file and execute php composer.phar update
.
Usage
To add the smooth scroll capability to a page add in the view:
use grptx\smoothscroll\SmoothScrollWidget; SmoothScrollWidget::widget();
Options
Availables options for the widget are:
- selector (default a[href*="#"])
- name (the javascript var name of scroll, default scroll)
- options (array of options defined by the library cfr: https://github.com/cferdinandi/smooth-scroll#global-settings)
Example
SmoothScrollWidget::widget([ 'selector' => 'a[href*="#"]', 'name' => 'myScroll', 'options' => [ 'header' => ... 'speed' => ... // etc .. ], ]);