简体   繁体   English

实现全宽滑块

[英]Materialize full width slider

I use materializecss to create a slider. 我使用materializecss创建一个滑块。 However the image is full width, but not full height(its more than full height, so i get scrollbars). 但是图像是全宽的,但不是全高的(它比全高大,所以我得到滚动条)。 What do i need to change to make the slider fill out my screen with no scrollbars? 我需要更改什么以使滑块在没有滚动条的情况下填满屏幕? I also use $('.slider').slider({full_width: true}); 我还使用$('.slider').slider({full_width: true});

<div class="navbar-fixed">
    <!-- some stuff-->
</div>
<div class="container-fluid">
    <div class="carousel carousel-slider center">
        <a class="carousel-item"><img class="responsive-img" src="http://lorempixel.com/800/400/food/1"></a>
    </div>
</div>

If you just want to hide scrollbars then add 如果您只想隐藏滚动条,请添加

overflow: hidden;

To container which is having the scroll 到具有滚动条的容器

Are you using the correct JavaScript? 您使用的是正确的JavaScript吗?

On Materialize's site (I've used Materialize before, and thought something looked off about your code) it has this as the way to initialize a slider as "full_width:" 在Materialize的网站上(我以前使用过Materialize,并且认为您的代码有些过时),它具有将滑块初始化为“ full_width:”的方式。

$('.carousel.carousel-slider').carousel({full_width: true});

In fact, your slider doesn't even have the .slider class; 实际上,您的滑块甚至没有.slider类。 it only has .carousel-slider and .carousel. 它只有.carousel-slider和.carousel。

I'm thinking if you use the above JavaScript you should be alright. 我在想,如果您使用上述JavaScript,应该没问题。

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

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