简体   繁体   中英

JQuery: How do I trigger two animations?

I was wondering if I could fadeout as well as slide the flash notification but that only one that works is the fadeOut. What can I do?

$(document).ready(function() {

            setTimeout(function(){
                $('#flash_wrapper').fadeOut("slow", function() {
                    $(this).remove();
                      })
                }, 4500);
            });

      </script>

I want to be able to use slideUp and FadeOut at the same time. How do I do that? I still dont know how to get these to work

You can use jQuery's .animate() to animate CSS properties:

$('#flash_wrapper').animate({
        height: 0, // like slideUp
        opacity: 0 // like fadeOut
    },
    4500, // speed
    function () { // called when animation is complete
        $(this).remove();
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM