@10up/reading-position 中文文档教程

发布于 3年前 浏览 33 项目主页 更新于 3年前

10up Reading Position component

查看此包的官方文档

Installation

npm install @10up/reading-position --save

Usage

CSS Imports

@import url("@10up/reading-position");

这些样式可以通过使用 PostCSS 导入或通过在您的项目中包含独立的 CSS 文件来导入到您现有的代码库中。

JavaScript

通过提供用于阅读位置的选择器和包含任何必要回调函数的对象来创建一个新实例。

import ReadingPosition from '@10up/reading-position';

new ReadingPosition( '.reading-position', {
    onCreate: function() {
        console.log( 'onCreate callback' );
    },
    scrollStart: function( percentage ) {
        console.log( 'scrollStart callback', percentage );
    },
    scrollEnd: function( percentage ) {
        console.log( 'scrollEnd callback', percentage );
    },
    scrolling: function( percentage ) {
        console.log( 'scrolling callback', percentage );
    }
} );

Support Level

活跃:10up 正在为此积极努力,我们希望在可预见的未来继续努力,包括保持对最新版本 WordPress 的测试。 欢迎错误报告、功能请求、问题和请求请求。

Like what you see?

使用 10up

10up Reading Position component

View official documentation for this package

Installation

npm install @10up/reading-position --save

Usage

CSS Imports

@import url("@10up/reading-position");

The styles can be imported into your existing codebase by using PostCSS imports, or by including the standalone CSS file in your project.

JavaScript

Create a new instance by supplying the selector to use for the reading-position and an object containing any necessary callback functions.

import ReadingPosition from '@10up/reading-position';

new ReadingPosition( '.reading-position', {
    onCreate: function() {
        console.log( 'onCreate callback' );
    },
    scrollStart: function( percentage ) {
        console.log( 'scrollStart callback', percentage );
    },
    scrollEnd: function( percentage ) {
        console.log( 'scrollEnd callback', percentage );
    },
    scrolling: function( percentage ) {
        console.log( 'scrolling callback', percentage );
    }
} );

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Like what you see?

Work with 10up

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文