@10up/component-accordion 中文文档教程
10up Accordion component
Installation
npm install --save @10up/component-accordion
Usage
CSS Imports
@import url("@10up/component-accordion");
通过使用 PostCSS 导入,或通过在项目中包含独立的 CSS 文件,可以将样式导入到现有代码库中。
JavaScript
通过提供用于手风琴的选择器和包含任何必要回调函数的对象来创建一个新实例。
import Accordion from '@10up/component-accordion';
new Accordion( '.accordion', {
onCreate: function() {
console.log( 'onCreate callback' );
},
onOpen: function( { link, content, heading } ) {
console.log( 'onOpen callback' );
},
onClose: function( { link, content, heading } ) {
console.log( 'onClose callback' );
},
onToggle: function( { link, content, heading } ) {
console.log( 'onToggle callback' );
}
} );
Demo
示例实施在:https
Support Level
://baseline.10up.com/component/accordion/ Active: 10up 正在积极致力于此,我们希望在可预见的未来继续工作,包括保持测试到最新版本的 WordPress。 欢迎错误报告、功能请求、问题和请求请求。
Like what you see?
10up Accordion component
View official documentation for this package
Installation
npm install --save @10up/component-accordion
Usage
CSS Imports
@import url("@10up/component-accordion");
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 accordion and an object containing any necessary callback functions.
import Accordion from '@10up/component-accordion';
new Accordion( '.accordion', {
onCreate: function() {
console.log( 'onCreate callback' );
},
onOpen: function( { link, content, heading } ) {
console.log( 'onOpen callback' );
},
onClose: function( { link, content, heading } ) {
console.log( 'onClose callback' );
},
onToggle: function( { link, content, heading } ) {
console.log( 'onToggle callback' );
}
} );
Demo
Example implementations at: https://baseline.10up.com/component/accordion/
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.