好的,我准备拿起这台电脑,把它从窗户扔出去。我有一个水平 ul 缩略图滑块,可以用灯箱打开缩略图。每个缩略图在灯箱中打开一组照片。滑块和灯箱效果都很好,但每个 li 是 3 种不同宽度中的 1 种。所以每一里要么相隔很远,要么相互碰撞。
li 宽度使用 CSS 设置为 100px。如果我未定义宽度,则滑块会折叠并仅显示前几个拇指。
我需要这个滑块来处理 100px、145px 和 175px 的宽度。有任何想法吗?显然,我不是专家。
这是滑块的代码:
<div id="slider1"> <a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="som106" title="My caption"><img src="img/thumbs/106_t.jpg" /></a><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="som106" title="My caption"></a><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="som106" title="My caption"></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/135_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/138_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/113_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/122_t.jpg"/></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/123_t.jpg"/></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
<li><a href="file:///S|/Design-Development/CUSTOMER DEVELOPMENT/SOLE OPTIONS/Web files (Johnny)/SO_site/flashIntro/img/image-1.jpg" data-lightbox="image-1" title="My caption"><img src="img/thumbs/106_t.jpg" /></a></li>
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
这是CSS
#slider1 {
height: 100px;
overflow: hidden;
margin-top: 20px;
padding-top: 0;
padding-right: 0;
padding-bottom: 10px;
padding-left: 0;
display: inline-block;
}
#slider1 .viewport {
float: left;
width: 1100px;
height: 100px;
overflow: hidden;
position: relative;
}
#slider1 .buttons {
background: url("../images/buttons.png") no-repeat scroll 0 0 transparent;
display: inline-block;
margin: 30px 10px 0 0;
background-position: 0 -38px;
text-indent: -999em;
float: left;
width: 39px;
height: 37px;
overflow: hidden;
position: relative;
}
#slider1 .next {
background-position: 0 0;
margin: 30px 0 0 10px;
}
#slider1 .disable {
visibility: hidden;
}
#slider1 .overview {
list-style: none;
position: absolute;
padding: 0;
margin: 0;
width: 240px;
left: 0 top: 0;
}
#slider1 .overview li {
float: left;
padding: 1px;
height: 100px;
width: 125px;
margin-top: 0px;
margin-right: 20px;
margin-bottom: 0;
margin-left: 0;
}
#slider1 .overviewMid li span {
float: left;
padding: 1px;
height: 100px;
width: 200px;
margin-top: 0px;
margin-right: 20px;
margin-bottom: 0;
margin-left: 0;
}
.overview li a {
opacity: .7;
}
.overview li a:hover {
opacity: 1;
}
请帮忙!谢谢。