本文整理匯總了TypeScript中perfect-scrollbar.initialize函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript initialize函數的具體用法?TypeScript initialize怎麽用?TypeScript initialize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了initialize函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: ngAfterViewInit
ngAfterViewInit(): void {
const container = this.elementRef.nativeElement.querySelector('md-nav-list');
Ps.initialize(container, { suppressScrollX: true });
this.state.library.take(1)
.subscribe(library => {
if (library.length === 0) {
this.loadDefaultLibrary();
}
});
}
示例2:
/**
* https://github.com/noraesae/perfect-scrollbar#how-to-use
*/
import * as Ps from 'perfect-scrollbar'
const container = document.body
// To initialise the plugin, `Ps.initialize` is used.
Ps.initialize(container)
// It can be initialised with optional parameters.
Ps.initialize(container, {
wheelSpeed: 2,
wheelPropagation: true,
minScrollbarLength: 20
})
// If the size of your container or content changes, call `update`.
Ps.update(container)
// If you want to destroy the scrollbar, use `destroy`.
Ps.destroy(container)
// If you want to scroll to somewhere, just use a `scrollTop` property and update.
container.scrollTop = 0
Ps.update(container)
/**
* https://github.com/noraesae/perfect-scrollbar#jquery
*/
示例3: requestAnimationFrame
requestAnimationFrame(() => PS.initialize(this.$element, {
wheelSpeed: 2,
wheelPropagation: false,
minScrollbarLength: 20,
suppressScrollX: true
}));