derekisbusy/yii2-waypoints

为Yii2项目提供Waypoints资源

dev-master 2019-06-23 21:15 UTC

This package is auto-updated.

Last update: 2024-08-24 09:44:55 UTC


README

为Yii2项目提供Waypoints资源

安装

安装此扩展的首选方式是通过composer

运行以下命令之一

php composer require --prefer-dist derekisbusy/yii2-waypoints:dev-master

或在您的composer.json文件的require部分添加

"derekisbusy/yii2-waypoints": "dev-master"

to

使用

安装扩展后,只需将其添加到视图

use \derekisbusy\waypoints\WaypointsAsset;

WaypointsAsset::register($this);

或将其添加到其他资源依赖列表

  public $depends = [
    'derekisbusy\waypoints\WaypointsAsset'
  ];

然后在视图中使用waypoints

<script>
var waypoint = new Waypoint({
  element: document.getElementById('waypoint'),
  handler: function(direction) {
    console.log('Scrolled to waypoint!')
  }
})
</script>

文档