简体   繁体   English

如何使滑块响应?

[英]How to make slider responsive?

I found this tutorial: How to make slider I tried to changed the .slider { width: 100%;} and li {width: 100%;} intended to make it responsive but doesn't works. 我找到了本教程: 如何制作滑块我尝试更改.slider { width: 100%;}li {width: 100%;}目的是使它具有响应能力,但不起作用。 Any idea how to make it responsive? 任何想法如何使其响应?

.slider and .slider > ul中也增加width:100%

There is this javascript 有这个JavaScript

this.ul.style.width = (this.li[0].clientWidth * this.li.length) + 'px'

since the li floated left the UL width is set to each li width * number of li items 由于li浮动向左,因此UL宽度设置为每个li宽度* li项数

So, in the tutorial the UL width is 1600px, when you set it to 100% and also set the li to 100% you will only be left with one li item. 因此,在本教程中,UL宽度为1600px,将其设置为100%并将li设置为100%时,您将只剩下一个li项目。

What is it that you actually want to do? 您实际上想做什么?

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

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