Starting jquery fadeToggle hidden

对着背影说爱祢 提交于 2019-12-13 19:42:36

问题


I want to use fadeToggle to fade in and out some images automatically. It's working, but all the images start 'faded in', and I would like them to start invisible, so that they appear one by one. Thanks in advance!

    $(function () {
function run_animation($element, delay, duration) {
    $element.delay(delay).fadeToggle(duration, function () {
        run_animation($element, delay, duration);
    });
}
run_animation($('.pointer1'), 2000, 1000);
run_animation($('.pointer2'), 2500, 1000);
run_animation($('.pointer3'), 3000, 1000);
run_animation($('.pointer4'), 3500, 1000);
run_animation($('.pointer5'), 4000, 1000);

回答1:


Did you try by hiding images using CSS? Try display:none and if required you can call animation after show().



来源:https://stackoverflow.com/questions/15753361/starting-jquery-fadetoggle-hidden

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