最近有人要求我做这个效果
http://mobile.bebitalia.com/home.do
但它是用 scriptaculus 制作的,我需要以某种方式使用 jquery 来实现它。
我找到了这个例子,但它只完成了一半
你能帮我做淡入完成后的淡出效果吗?
最佳答案
我正在制作一个 fiddle ,但您可以使用类似的标记作为您给出的示例来尝试
// Translated from scriptaculus
// http://mobile.bebitalia.com/home.do
function hideCube() {
$('#gctu1w_bg').show('slow');
$('.cube').each(function(index, element) {
var sleepTime = Math.floor(Math.random() * 2000);
var t = setTimeout(function() {
var d = Math.floor(Math.random() * 2000);
$(element).fadeTo(d, 0);
}, sleepTime);
});
}
$(function() {
$('.cube').each(function(index, element) {
var sleepTime = Math.floor(Math.random() * 2000);
var t = setTimeout(function() {
var d = Math.floor(Math.random() * 1000);
$(element).fadeTo(d, 0.99);
}, sleepTime);
});
var h = setTimeout(hideCube, 4000);
});
关于jquery - 使用 jquery 随机淡入和淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5667375/