问题描述
在jquery
或javascript中是否有一种方法可以检测元素的不透明度何时发生变化,然后启动函数以添加新效果,例如,如果您有一个页面,其中发生了自动事情,例如元素淡入,那么您想要在发生这种情况时发射其他东西.你会怎么做??
Is there a way in jquery
or javascript to detect when then opacity of an element changes then launch a function to add new effects like for example if you had a page where automatic things happen like an element faded in then you wanted to launch something else when that happened. How would you do this???
有点像幻灯片放映.
以下是我到目前为止的演示:
Here is a demo of what I have so far:
http://jsfiddle.net/Hive7/n57Zy/
当最后一个元素的不透明度发生变化时,我要比我想再重新开始循环
Than I want when the last elements opacity changes then start the loop again
预先感谢
推荐答案
我正在谈论的一个示例为您提供了想法.
An example of what i'm talking about, gives you the idea.
var delayOL = d;
var fadeLoop = (function fadeLoop(i) {
$('.slideshow img').eq(i).delay(delayOL).fadeOut(d, function () {
i++;
if (i === $('.slideshow').find('img').length) i = 0;
$('.slideshow img').eq(i).fadeIn(d, function () {
delayOL = 0;
setTimeout(function () {
fadeLoop(i)
}, g);
});
});
})(0);
这篇关于检测不透明度变化的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!