Javascript Jquery循环-不同速度转换的幻灯片放映?
我正在尝试用不同的速度值制作渐变幻灯片,以获得过渡效果 我不想更改超时或Fx…我只想更改每个图像的速度转换值…有可能吗 提前非常感谢 代码如下:Javascript Jquery循环-不同速度转换的幻灯片放映?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我正在尝试用不同的速度值制作渐变幻灯片,以获得过渡效果 我不想更改超时或Fx…我只想更改每个图像的速度转换值…有可能吗 提前非常感谢 代码如下: $('#s1').cycle({ fx: 'fade', speed: 1000, //this is that I want to change for each img!!! timeout: 1700, next: '#s1', }); <div id="s1" class="pics"&g
$('#s1').cycle({
fx: 'fade',
speed: 1000, //this is that I want to change for each img!!!
timeout: 1700,
next: '#s1',
});
<div id="s1" class="pics">
<img src="img.jpg" width="450" height="300" />
<img src="img.jpg" width="450" height="300" />
<img src="img.jpg" width="450" height="300" />
</div>
我使用以下属性来声明每张幻灯片的延迟:
timeoutFn: function (a) { return $(a).data('delay') * 1000; },
/.../
从幻灯片中读取延迟数据属性
即,您的图像标签需要按照以下方式进行装饰:
<div id="s1" class="pics">
<img src="img.jpg" width="450" height="300" data-delay="1" />
<img src="img.jpg" width="450" height="300" data-delay="2" />
<img src="img.jpg" width="450" height="300" data-delay="3" />
</div>
$('#s1').cycle({
fx: 'fade',
speed: 1000, //this is that I want to change for each img!!!
timeout: 1700,
next: '#s1',
before: function(e1, e2, opts) { opts.speed = parseInt($(e1).data('speed')); }
});
谢谢对不起,我写了你的代码,但它不工作…可能是我写错了什么!现在,我有类似的东西。对吗?$'循环{fx:'fade',超时:1700,下一个:'s1',前一个:functione1,e2,opts{opts.speed=parseInt$e1.data'speed';};