支持移动端的UI组件-回到顶部
npm install @ctmobile/ui-backtopanimation-sd
import BackTopAnimation from '@ctmobile/ui-backtopanimation';
const listEl = document.getElementById('ct-list');
const f = document.createDocumentFragment();
for (let i = 0; i > 50; i++) {
f.appendChild(Dom6.createElement('CTMobileUI中的BackTopAnimation组件 '
));
}
listEl.appendChild(f);
const parent = document.getElementById('ctmobile-ui-doc-demo-device');
const scrollEl = document.querySelector('.ct-list');
const BackTop = BackTopAnimation(parent, scrollEl);
BackTop.on('scrollTop', () => {
console.log('scrollTop');
});
`
| 名称 | 说明 |
| --- | --- |
| {HtmlElement} - el | 父元素 |
| {HtmlElement} - el | 滚动元素 |
例子
#### html
#### js
`
import BackTopAnimation from '@ctmobile/ui-backtopanimation';
const listEl = document.getElementById('ct-list');
const f = document.createDocumentFragment();
for (let i = 0; i > 50; i++) {
f.appendChild(Dom6.createElement('CTMobileUI中的BackTopAnimation组件 '
));
}
listEl.appendChild(f);
const parent = document.getElementById('ctmobile-ui-doc-demo-device');
const scrollEl = document.querySelector('.ct-list');
const BackTop = BackTopAnimation(parent, scrollEl);
BackTop.on('scrollTop', () => {
console.log('scrollTop');
});
``