gpt4 book ai didi

jquery - 如何自动旋转图像

转载 作者:太空宇宙 更新时间:2023-11-03 19:44:52 26 4
gpt4 key购买 nike

如何自动旋转图片?请检查我的 fiddle ,我试图在没有任何点击事件的情况下自动更改图像请检查这个 fiddle :http://jsfiddle.net/hu3v8/1/

<div id="slider-code">
<div class="viewport">
<ul class="overview">
<li><img src="http://www.baijs.nl/tinycarousel/images/picture3.jpg" /></li>
<li><img src="http://www.baijs.nl/tinycarousel/images/picture2.jpg" /></li>
<li><img src="http://www.baijs.nl/tinycarousel/images/picture1.jpg" /></li>
</ul>
</div>
<a class="buttons next" id="nextButton" href="#">right</a>
</div>

最佳答案

http://baijs.com/tinycarousel/

您使用的tinycarousel插件已经提供了动画示例

请使用选项 intervalintervalTime

$(function() {

var current = 1;
var totalImages = $("#slider-code li").size();
var oSlider = $('#slider-code').tinycarousel({
animation: true,
controls: false,
interval: true, // set interval option
intervalTime: 1000 // 1 second
});

$('#nextButton').click(function() {
current += 1;
if (current > totalImages) {
current = 1;
}
oSlider.tinycarousel_move(current);
});
});
#slider-code {
height: 125px;
overflow: hidden;
}
#slider-code .viewport {
float: left;
width: 240px;
height: 125px;
overflow: hidden;
position: relative;
}
#slider-code .buttons {
display: block;
margin: 30px 10px 0 0;
float: left;
}
#slider-code .next {
margin: 30px 0 0 10px;
}
#slider-code .disable {
visibility: hidden;
}
#slider-code .overview {
list-style: none;
position: absolute;
padding: 0;
margin: 0;
left: 0;
top: 0;
}
#slider-code .overview li {
float: left;
margin: 0 20px 0 0;
padding: 1px;
height: 121px;
border: 1px solid #dcdcdc;
width: 236px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://baijs.com/tinycarousel/js/jquery.tinycarousel.js"></script>

<div id="slider-code">

<div class="viewport">
<ul class="overview">
<li>
<img src="http://www.baijs.nl/tinycarousel/images/picture3.jpg" />
</li>
<li>
<img src="http://www.baijs.nl/tinycarousel/images/picture2.jpg" />
</li>
<li>
<img src="http://www.baijs.nl/tinycarousel/images/picture1.jpg" />
</li>
</ul>
</div>
<a class="buttons next" id="nextButton" href="#">right</a>
</div>

关于jquery - 如何自动旋转图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31824023/

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