@ctmobile/ui-backtopanimation

1.0.1 • Public • Published

BackTopAnimation

初始化

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(<pre><code class="html">'<li>CTMobileUI中的BackTopAnimation组件</li>'</code></pre>));
}
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(<pre><code class="html">'<li>CTMobileUI中的BackTopAnimation组件</li>'</code></pre>));
}
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');
});

方法

on( type, handler, ) - 注册事件

  • type-string 事件类型
  • handler-Function 事件句柄

off( type, handler, ) - 注销事件

  • type-string 事件类型
  • handler-Function 事件句柄

事件

名称 说明
scrollTop 滚动到了顶部

Package Sidebar

Install

npm i @ctmobile/ui-backtopanimation

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

24.7 kB

Total Files

13

Last publish

Collaborators

  • playerljc