我使用的是物化设计、Jquery和javascript。我想实现设置多个图像在一行和自动移动到特定的方向。现在,我在物化设计中使用3d效果旋转木马。但效果不佳。当我放置锚标签(放置重定向链接),那么它将卡住(一段时间)。
$('.carousel').carousel({
dist: 0,
shift: 0,
padding: 20,
interval: 100
});.carousel .carousel-item {
opacity: 1 !important;
}<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script>
<div class="carousel">
<a class="carousel-item" href="#one!">
<img src="http://lorempixel.com/250/250/nature/1">
</a>
<a class="carousel-item" href="#two!">
<img src="http://lorempixel.com/250/250/nature/2">
</a>
<a class="carousel-item" href="#three!">
<img src="http://lorempixel.com/250/250/nature/3">
</a>
<a class="carousel-item" href="#four!">
<img src="http://lorempixel.com/250/250/nature/4">
</a>
<a class="carousel-item" href="#five!">
<img src="http://lorempixel.com/250/250/nature/5">
</a>
</div>
我想像应用程序一样实现。http://www.jqueryrain.com/?Q5dad1oS
我想显示多个小图像。但我不想用任何插件。因为我不想增加页码。
发布于 2016-05-10 05:41:00
我找到了我问题的答案。我没有使用任何插件就实现了旋转木马。它使用普通的javascript或jquery。
var firstval = 0;
function Carousel() {
firstval += 2;
parent = document.getElementById('container');
parent.style.left = "-" + firstval + "px";
if (!(firstval % 150)) {
setTimeout(Carousel, 3000);
firstval = 0;
var firstChild = parent.firstElementChild;
parent.appendChild(firstChild);
parent.style.left= 0;
return;
}
runCarousel = setTimeout(Carousel, 10);
}
Carousel(); #wrapper {
position: relative;
width: 450px;
height: 150px;
margin: 0 auto;
overflow: hidden;
}
#container {
position: absolute;
width: 450px;
height: 150px;
}
.child {
width: 150px;
height: 150px;
padding-top: 35px;
float: left;
text-align: center;
font-size: 60px;
}<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<div id="wrapper">
<div id="container">
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0020232_chocolate_cream_gateaux_cake_320.jpeg"> </div>
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0018904_50_red_roses_in_vase_320.jpeg"> </div>
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0020232_chocolate_cream_gateaux_cake_320.jpeg"> </div>
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0020232_chocolate_cream_gateaux_cake_320.jpeg"> </div>
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0018904_50_red_roses_in_vase_320.jpeg"> </div>
<div class="child"><img width="100" src="https://d2z4fd79oscvvx.cloudfront.net/0020232_chocolate_cream_gateaux_cake_320.jpeg"> </div>
</div>
</div>
发布于 2016-05-06 05:52:25
https://stackoverflow.com/questions/37065155
复制相似问题