How do I use MDCSlider in JavaScript?
问题 I have created an DOM element for an MDC slider (https://material.io/develop/web/components/sliders). It looks nice (except for the colors). And it works, but I really have no idea how to initialize it. I import MDC from the CDN. I can't understand from the documentation how to do the initialization. This is one version that works: setTimeout(() => { slider = new mdc.slider.MDCSlider(eltSlider) }); Without setTimeout it does not work. I have tried using a Promise instead and wait a second.