Clearinterval name isn't defined after JS while loop
<p>I'm using this code:</p>

<pre><code>var s_wrap = document.getElementById('slider');
var s_list = document.getElementById('slider-list');
var li_items = s_list.getElementsByTagName("li");
var next = document.getElementById('next');
var pos, item_w, refreshIntervalId;

next.onclick = function() { 
    item_w = window.getComputedStyle(li_items[0],null).getPropertyValue("width").split('px')[0]; 
    move('left', li_items[0], 10, item_w);
};

var move = function(direction, el, increment, amount) {
    while(pos &lt;= amount){
        keep_moving = setInterval(function(){
            pos = el.style[direction].split('px')[0];
            if(pos == '') pos = 0;
            pos = parseInt(pos) + increment;
            el.style[direction] = pos + 'px';
        }, 100);
    }
    clearInterval(keep_moving); 

};
</code></pre>

<p>So basic gist of the code is, click a div, move a div left by 10 pixels at a time until it reaches 600px.</p>

<p>Now am I going about this the wrong way?</p>

<p>At the moment I get a </p>

<pre><code>Uncaught ReferenceError: keep_moving is not defined
</code></pre>
