jQuery fadein fadeout repeatedly

故事扮演 提交于 2019-12-23 21:34:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!