Credit-like scroll effects at the end of a movie

Asked

Viewed 27 times

1

I’m trying to get the scroll to automatically scroll all the data and when it’s finished go back to the beginning and start all over again.

I use this script:

<script type="text/javascript">
        $(document).ready(function(e) {
            var div = $('#teste');
            setInterval(function(){
                var pos = div.scrollTop();
                div.scrollTop(pos + 2);
            }, 200)
        });
    </script>

but I can’t make it go back to the beginning. Even if you reload the page it doesn’t come back. The effect you want is similar to the credits at the end of a movie.

Someone can help. Thank you very much.

  • puts an if inside the function, at the end of everything, that says that if the scroll has reached the bottom (end), it becomes 0. Then put the code here and mark as answer :)

  • 1

    Murilo Gamboa, I couldn’t. I’ll keep doing some tests.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.