Search code examples
jqueryanimationtweak

Making jquery animation larger


So I have been playing around with jquery animation and I have got it working using this method:

$(function() {
    $("#div3").animate(
        {top : "+=100"}, 500, function() {}
    );
});

http://jsfiddle.net/dT9Yk/ My problem is it doesn't fall very far, I was wondering if there is a way to tweak to make it fall from top of the page kind of like:

http://texts.com/

Thank You!


Solution

  • DEMO

    $(function() {
        $('#div3')
        .css({
            // position the element off the top of the page
            top : ($('#div3').height() * -1) - $('#div3').offset().top
        }).animate(
            // animate to its natural resting place
            {top : 0}, 500, function() {}
        );
    });