问题
I have a image and in it wants to be fadein fadeout automatically when the document is loaded and it should be done till the document is closed .. help me plzz
回答1:
this'll do it:
$(function () {
$('#fader').fadeIn('slow', function () {
fadeItOut();
});
});
function fadeItIn() {
$('#fader').fadeIn('slow', function () {
fadeItOut();
});
}
function fadeItOut() {
$('#fader').fadeOut('slow', function () {
fadeItIn();
});
}
with
fader being the id of your image
回答2:
$( function() {
var t = 500;
setInterval( function(){
$('#id').fadeOut( t, function(){ $(this).fadeIn( t ); } );
}, 2*t);
});
id
is the image id and t
is the interval.
来源:https://stackoverflow.com/questions/3451407/jquery-fadein-fadeout-repeatedly