@10up/reading-position 中文文档教程
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 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.