// funkcni
        // $.when(animate()).then(function()
        // {
        //     console.log('DONE');
            
        // });

        // funkcni
        // animate().then(function()
        // {
        //     console.log('DONE');
            
        // });

        function animate($callback)
        {
            return $.Deferred(function(dfd) {
        
                var $this = $('h2');
                var $wordList = $this.text().split("");
                $this.text("");
                $this.css('opacity', 1);
        
                $.each($wordList, function (idx, elem) {
                    var newEL = $("<span/>").text(elem).css({
                        opacity: 0
                    });

                    newEL.appendTo($this);
                    newEL.delay(idx * 125);
                    newEL.animate({
                        opacity: 1
                    }, 500, 'swing', function() {
                        if ($wordList.length === idx + 1)
                        {
                            dfd.resolve();
                        }
                    });
                });

        }).promise();

    }