1 | import BaseComponent, { GetInstanceFactory, GetOrCreateInstanceFactory } from './base-component';
|
2 |
|
3 | declare class ScrollSpy extends BaseComponent {
|
4 | /**
|
5 | * Static method which allows you to get the scrollspy instance associated
|
6 | * with a DOM element
|
7 | */
|
8 | static getInstance: GetInstanceFactory<ScrollSpy>;
|
9 |
|
10 | /**
|
11 | * Static method which allows you to get the scrollspy instance associated with
|
12 | * a DOM element, or create a new one in case it wasn’t initialised
|
13 | */
|
14 | static getOrCreateInstance: GetOrCreateInstanceFactory<ScrollSpy, Partial<ScrollSpy.Options>>;
|
15 |
|
16 | static jQueryInterface: ScrollSpy.jQueryInterface;
|
17 |
|
18 | /**
|
19 | * Default settings of this plugin
|
20 | *
|
21 | * @link https://getbootstrap.com/docs/5.0/getting-started/javascript/#default-settings
|
22 | */
|
23 | static Default: ScrollSpy.Options;
|
24 | constructor(element: string | Element, options?: Partial<ScrollSpy.Options>);
|
25 |
|
26 | /**
|
27 | * When using scrollspy in conjunction with adding or removing of
|
28 | * elements from the DOM, you’ll need to call the refresh method like
|
29 | * so:
|
30 | */
|
31 | refresh(): void;
|
32 | }
|
33 |
|
34 | declare namespace ScrollSpy {
|
35 | enum Events {
|
36 | /**
|
37 | * This event fires on the scroll element whenever a new item becomes
|
38 | * activated by the scrollspy.
|
39 | */
|
40 | activate = 'activate.bs.scrollspy',
|
41 | }
|
42 |
|
43 | interface Options {
|
44 | /**
|
45 | * Pixels to offset from top when calculating position of scroll.
|
46 | *
|
47 | * @default 10
|
48 | */
|
49 | offset: number;
|
50 |
|
51 | /**
|
52 | * Finds which section the spied element is in. auto will choose the
|
53 | * best method to get scroll coordinates. offset will use the
|
54 | * Element.getBoundingClientRect() method to get scroll coordinates.
|
55 | * position will use the HTMLElement.offsetTop and
|
56 | * HTMLElement.offsetLeft properties to get scroll coordinates.
|
57 | *
|
58 | * @default 'auto'
|
59 | */
|
60 | method: 'auto' | 'offset' | 'position';
|
61 |
|
62 | /**
|
63 | * Specifies element to apply Scrollspy plugin.
|
64 | */
|
65 | target: string | Element | JQuery;
|
66 | }
|
67 |
|
68 | type jQueryInterface = (config?: Partial<Options> | 'refresh' | 'dispose') => void;
|
69 | }
|
70 |
|
71 | export default ScrollSpy;
|