aurelia-materialize-bridge
Version:
Aurelia interface to http://materializecss.com/
27 lines (21 loc) • 619 B
text/typescript
import * as au from "../aurelia";
.customAttribute("md-parallax")
.autoinject
export class MdParallax {
constructor(private element: Element) { }
.ato.bindable.numberMd({defaultBindingMode: au.bindingMode.oneTime})
responsiveThreshold: number;
instance: M.Parallax;
attached() {
this.element.classList.add("parallax");
let options: Partial<M.ParallaxOptions> = {
responsiveThreshold: this.responsiveThreshold
};
au.cleanOptions(options);
this.instance = new M.Parallax(this.element, options);
}
detached() {
this.instance.destroy();
this.element.classList.remove("parallax");
}
}