简体   繁体   English

我如何使用Materialise Mediabox组件

[英]How do I use the Materialize Mediabox component

I would like to implement the slider on this page: http://materializecss.com/media.html 我想在此页面上实现滑块: http : //materializecss.com/media.html

I copied the initialization script with my chosen input as so: 我将初始化脚本复制为所选的输入,如下所示:

<script>
var elem = document.querySelector('.slider');
var instance = M.Slider.init(elem, inDuration:180);
</script>

And pasted at the end of my body. 并粘贴在我的身体末端。 The page does not display anything even when using the example html code provided. 即使使用提供的示例html代码,页面也不会显示任何内容。 What I am doing wrong? 我做错了什么? Thanks 谢谢

You are directly giving value to the options parameter. 您直接将值赋给options参数。 Instead of that, first declare that option, give it a desired value, and then use it in the function, like this: 取而代之的是,首先声明该选项,为其提供所需的值,然后在函数中使用它,如下所示:

var elem = document.querySelector('.slider');
var height = 500;
let inDuration = 1800;
var instance = M.Slider.init(elem, inDuration);

If you want to see a working demo, you can find it on my codepen . 如果您想查看有效的演示,可以在我的codepen上找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM