I'm trying to use jquery animate to do marquee running text on my html. Below is my code:
$(document).ready(function() {
$('.scroll').animate({
right: $(document).width() // animates right value from the original -200px(from css) to the documents width(ie if elements right value = the document width, then element is off screen)
}, 3000);
});
.scroll {
position: absolute;
right: -200px;
width: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="scroll">This text be scrollin'!</div>
Here is the demo: https://jsfiddle.net/y9hvr9fa/
The problem is, it just run for one time only. May I know how to make it to run in endless loop?