A TypeScript plugin for BetterScroll that provides enhanced mouse wheel scrolling capabilities with configurable speed, direction, easing, and boundary damping on PC platforms.
Overall
score
98%
Build a scrollable content viewer that can dynamically toggle scrolling, handle content updates, and properly clean up resources. The viewer should support adding/removing content items and allow users to enable or disable scrolling behavior.
Create a content scroller component with the following functionality:
Implement methods to enable and disable scrolling dynamically. When disabled, the scroll container should not respond to user scroll gestures. When enabled, normal scrolling should work.
The scroll container should handle dynamic content changes. When content is added or removed from the scrollable area, the scroller should recalculate its boundaries to accommodate the new content size.
Implement proper cleanup to remove all event listeners and free resources when the scroller is no longer needed.
@generates
export interface ContentScrollerOptions {
scrollY?: boolean;
scrollX?: boolean;
click?: boolean;
probeType?: number;
}
export class ContentScroller {
constructor(wrapper: HTMLElement, options?: ContentScrollerOptions);
/**
* Enable scrolling functionality
*/
enableScroll(): void;
/**
* Disable scrolling functionality
*/
disableScroll(): void;
/**
* Update scroller after content changes
*/
updateContent(): void;
/**
* Clean up and destroy the scroller instance
*/
cleanup(): void;
/**
* Get current enabled state
*/
isEnabled(): boolean;
}Provides smooth scrolling functionality with momentum and boundary handling.
Install with Tessl CLI
npx tessl i tessl/npm-better-scroll--mouse-wheeldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10