jeudi 13 août 2015

Fadeout page after animation finishes

I want an animation (function handleScreen(mql)) to run and after it is completed, for the page (#splash,#name) to fade out. I tried adding a .done function but that doesn't seem to work. Any help would be very much appreciated.

$(document).ready(function() {

        $("#splash,#name").show()

        var mql = window.matchMedia("(max-width: 480px)");

        function smallBlock() {
            //STUFF
        };

        function largeBlock() {
           //STUFF
        };

        function handleScreen(mql) {
            if (mql.matches) {
                smallBlock();
            } else {
                largeBlock();
            }

            mql.addListener(handleScreen);
            handleScreen(mql);
        };

        $.when(handleScreen(mql).done(function() {
                    setTimeout(function() {
                        $("#name,#splash").fadeOut("slow")
                    }, 1000)
                });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire