Question: here is my jsfiddle <http://jsfiddle.net/9XdV7/>, how to make when hover in - text scroll and infinite loop, out - back to start position? now it can't infinite loop scroll

```
for (var i = 0; i < $('.list').length; i++) {
    var this_el = $('.list').eq(i);
    var interval = null;

    $(this_el).hover(function() {
      var that = $(this);
      var this_indent = 0;

      interval = setInterval(function(){
        this_indent--;
        if (this_indent == -($(that).find('.text').width())) {
          clearInterval(interval);
          this_indent = 0;

          // how to loop scroll
        }
        $(that).css('text-indent', this_indent);
      },20);

    }, function() {
        clearInterval(interval);
        $(this).css('text-indent', 0);
    });
}

```

html & css

```
<div class="list"><div class="text">stringstringstringstring</div></div>
<div class="list"><div class="text">stringstringstring</div></div>
<div class="list"><div class="text">stringstringstringstring</div></div>    

.list {
width: 100px;
overflow: hidden;
white-space:nowrap;

height: 15px;
background-color: red;
margin: 10px;
}
.text {
text-align: left;
background-color: purple;
display: inline;
}

```

Answer: 
Is this what you're looking for? [Fiddle](http://jsfiddle.net/Whre/Q2rny/1/)

1. I used mouseenter and mouseleave instead of hover.
`$(elem).on("mouseenter",function() { ... });`
2. I stored the identifier belonging to the element in its data: `$(this).data("interval",interval);`
3. I added 

```
if(this_indent < -150) {
   this_indent = 100;
}

```

to make the effect infinite. -150 is a value I got from the developer tools. 100 is pure testing.
This still wants some tweaking for determining the point at which to loop, but I think it's basically what you want:

```
$(function() {
    for (var i = 0; i < $('.list').length; i++) {
        var this_el = $('.list').eq(i);
        var interval = null;

        $(this_el).hover(function() {
          var that = $(this);
          var this_indent = 0;
          interval = setInterval(function(){
            this_indent--;
            if (this_indent < that.width() * -1)
                this_indent = that.width();
            that.css('text-indent', this_indent);
          },20);            

        }, function() {
            clearInterval(interval);
            $(this).css('text-indent', 0);
        });
    }

});

```

It's looping based on the width of the div, rather than the actual length of the text. If you want the text width, you could look here: [Calculating text width](https://stackoverflow.com/questions/1582534/calculating-text-width-with-jquery)