aurelia-materialize-bridge
Version:
Aurelia interface to http://materializecss.com/
37 lines (28 loc) • 869 B
text/typescript
import * as au from "../aurelia";
.customAttribute("md-scrollspy")
.autoinject
export class MdScrollSpy {
constructor(private element: Element) { }
instance: M.ScrollSpy;
.ato.bindable.numberMd({defaultBindingMode: au.bindingMode.oneTime})
throttle: number;
.ato.bindable.numberMd({defaultBindingMode: au.bindingMode.oneTime})
scrollOffset: number;
.ato.bindable.stringMd({defaultBindingMode: au.bindingMode.oneTime})
activeClass: string;
.bindable
getActiveElement: (id: string) => string;
attached() {
let options: Partial<M.ScrollSpyOptions> = {
throttle: this.throttle,
scrollOffset: this.scrollOffset,
activeClass: this.activeClass,
getActiveElement: this.getActiveElement
};
au.cleanOptions(options);
this.instance = new M.ScrollSpy(this.element, options);
}
detached() {
this.instance.destroy();
}
}