开发者

jQuery fadein fadeout repeatedly

开发者 https://www.devze.com 2023-01-11 12:52 出处:网络
I have a image and in it wants to be fadein fadeout开发者_C百科 automatically when the document is loaded and it should be done till the document is closed ..

I have a image and in it wants to be fadein fadeout开发者_C百科 automatically when the document is loaded and it should be done till the document is closed .. help me plzz


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


$( 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号