-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathscrollbox.d.ts
More file actions
132 lines (115 loc) · 3.09 KB
/
scrollbox.d.ts
File metadata and controls
132 lines (115 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/**
* TypeScript definitions for ScrollBox
*/
export interface ScrollBoxConfig {
/** Use linear scrolling animation */
linear?: boolean;
/** Initial delay before scrolling starts (seconds) */
startDelay?: number;
/** Delay between scroll events (seconds) */
delay?: number;
/** Distance of each step in pixels (for linear mode) */
step?: number;
/** Animation speed in milliseconds */
speed?: number;
/** Number of items to switch per scroll */
switchItems?: number;
/** Scroll direction: 'vertical' or 'horizontal' */
direction?: 'vertical' | 'horizontal';
/** Scroll distance or 'auto' */
distance?: number | 'auto';
/** Enable auto-scrolling */
autoPlay?: boolean;
/** Pause on mouse hover */
onMouseOverPause?: boolean;
/** Initial paused state */
paused?: boolean;
/** Queue container ID for advanced usages */
queue?: string | null;
/** List element selector */
listElement?: string;
/** List item element selector */
listItemElement?: string;
/** Enable infinite looping */
infiniteLoop?: boolean;
/** Total switches before stopping (0 = infinite) */
switchAmount?: number;
/** Callback after forward scroll */
afterForward?: ((data: ScrollBoxCallbackData) => void) | null;
/** Callback after backward scroll */
afterBackward?: ((data: ScrollBoxCallbackData) => void) | null;
/** Allow stacking trigger events */
triggerStackable?: boolean;
}
export interface ScrollBoxCallbackData {
/** Current switch count */
switchCount: number;
/** Current first child element */
currentFirstChild: Element | null;
}
export default class ScrollBox {
/**
* Create a new ScrollBox instance
* @param element - The container element
* @param options - Configuration options
*/
constructor(element: HTMLElement, options?: ScrollBoxConfig);
/** The container element */
element: HTMLElement;
/** Configuration object */
config: Required<ScrollBoxConfig>;
/** Whether scrolling is currently paused */
paused: boolean;
/** Current switch count */
switchCount: number;
/**
* Scroll forward
*/
forward(): void;
/**
* Scroll backward
*/
backward(): void;
/**
* Enable forward scrolling on hover
*/
forwardHover(): void;
/**
* Pause scrolling on hover
*/
pauseHover(): void;
/**
* Reset the scroll clock
* @param delay - Optional new delay in seconds
*/
resetClock(delay?: number): void;
/**
* Increase scroll speed
* @param speed - New speed in milliseconds
*/
speedUp(speed?: number): void;
/**
* Decrease scroll speed
* @param speed - New speed in milliseconds
*/
speedDown(speed?: number): void;
/**
* Update configuration
* @param options - Partial configuration to update
*/
updateConfig(options: Partial<ScrollBoxConfig>): void;
/**
* Destroy the ScrollBox instance and clean up
*/
destroy(): void;
}
// jQuery plugin definitions
declare global {
interface JQuery {
/**
* Initialize ScrollBox on jQuery elements
* @param config - Configuration options
*/
scrollbox(config?: ScrollBoxConfig): JQuery;
}
}