Page jumps to top when using Javascript rotating background
<p>I am using javascript for a rotating background image. The problem is, every time the image changes, the page jumps to the top. Hopefully this is an easy fix!</p>

<p>Here is my code:</p>

<pre><code>&lt;script type='text/javascript'&gt; 
$(window).load(function(){


var initialBg =  $('#slider').css("background-image"); // added

var firstTime = true;
var arr = [initialBg, "url(/wp-content/uploads/2013/03/slider2-explore.png)", "url(/wp-    content/uploads/2013/03/slider3-experience.png)"];
(function recurse(counter) {
    var bgImage = arr[counter];
    if (firstTime == false) {
        $("#slider").fadeOut("slow", function(){
            $('#slider').css('background-image', bgImage);
        });
        $("#slider").fadeIn("slow");
    } else {
        firstTime = false;
    }               
    delete arr[counter];
    arr.push(bgImage);
    setTimeout(function() {
        recurse(counter + 1);
    }, 4500);  
})(0);  

});
&lt;/script&gt; 
</code></pre>
