DefinitelyTyped/types/materialize-css/scrollspy.d.ts
Max a355d32369 materialize-css: Add missing declarations and tests (#25492)
* Restructure files and add missing declarations

* Add JQuery declarations

* Restructure tests

* Add carousel tests

* Add more tests and missing JQuery declarations

* Add waves declaration and a test

* Add static init methods and tests

* allow jquery and cash object to be passed to init

* Remove redundant reference

* Clean up

* Clean up

* Clean up and add tests

* Clean up and add tests
2018-05-07 11:00:18 -07:00

52 lines
1.2 KiB
TypeScript

/// <reference path="./common.d.ts" />
declare namespace M {
class ScrollSpy extends Component<ScrollSpyOptions> {
/**
* Get Instance
*/
static getInstance(elem: Element): ScrollSpy;
/**
* Init ScrollSpy
*/
static init(els: Element, options?: Partial<ScrollSpyOptions>): ScrollSpy;
/**
* Init ScrollSpies
*/
static init(els: MElements, options?: Partial<ScrollSpyOptions>): ScrollSpy[];
}
interface ScrollSpyOptions {
/**
* Throttle of scroll handler
* @default 100
*/
throttle: number;
/**
* Offset for centering element when scrolled to
* @default 200
*/
scrollOffset: number;
/**
* Class applied to active elements
* @default 'active'
*/
activeClass: string;
/**
* Used to find active element
* @default id => 'a[href="#' + id + '"]'
*/
getActiveElement: (id: string) => string;
}
}
interface JQuery {
scrollSpy(options?: Partial<M.ScrollSpyOptions>): JQuery;
scrollSpy(method: keyof Pick<M.ScrollSpy, "destroy">): JQuery;
}