gpt4 book ai didi

javascript - Twitter Bootstrap,轮播上的图像覆盖

转载 作者:行者123 更新时间:2023-11-27 23:52:52 25 4
gpt4 key购买 nike

我用这个Bootstrap Vertical Thumbnail Carousel创建 Bootstrap 缩略图垂直旋转木马的源代码,它在 Firefox 和 Safari(最新版本)中的工作方式类似于 charm,但在 chrome 中则不然。

当按下 next 或 pre 时,问题出现在 firefox 和 safari 中。按钮,当前一堆图像滚动和新的图像滚动之后。但是在 chrome 中,第二束排在第一位并放在第一束上方,然后第一束消失,

这是我的代码 JS Fiddle HERE

    <!DOCTYPE html>
<html lang="en">
<head>
<title>Thumbnail Slider</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body data-twttr-rendered="true" data-spy="scroll" data-target=".bs-docs-sidebar">
<div class="container">

<div class="span8">

<h1>&nbsp;</h1>

<div class="well" >

<div id="myCarousel" class="carousel vertical slide" >
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><img src="icon/up.png"></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><img src="icon/down.png"></a>

<!-- Carousel items -->
<div class="carousel-inner">

<div class="item active">
<div class="row-fluid">
<table>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/1.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/2.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/3.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/4.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
</table>
</div><!--/row-fluid-->
</div><!--/item-->

<div class="item">
<div class="row-fluid">
<table>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/5.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/6.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/7.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/8.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
</table>
</div><!--/row-fluid-->
</div><!--/item-->

<div class="item">
<div class="row-fluid">
<table>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/9.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/10.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/11.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
<tr>
<td><div class="span3"><a href="#x" style = " width:50px; " class="thumbnail"><img src="image/12.gif" alt="Image" style="max-width:100%; width:50px;"></a></div></td>
</tr>
</table>
</div><!--/row-fluid-->
</div><!--/item-->

</div><!--/carousel-inner-->

</div><!--/myCarousel-->

</div><!--/well-->
</div>
</div>

<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/script.js"></script>
</body>
</html>

最佳答案

问题在于轮播容器 (#myCarousel) 没有明确的高度。它的 child .carousel-innerheight:100%,但是由于 #myCarousel 没有明确的高度,这个百分比值没有效果,轮播元素的基于百分比的偏移量也是如此。

最快的解决方案是设置提到的高度:

#myCarousel{
height:380px; /* or em, or some other fixed value*/
}

/* OR */

.carousel-inner{
height:380px;/* or em, or some other fixed value*/
}

Live

但它不是很灵活:如果你需要改变元素的数量或大小,这个高度也需要改变。

关于javascript - Twitter Bootstrap,轮播上的图像覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25786742/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com