// JavaScript Document var scrollSpeed = 70; // Speed in milliseconds var step = 0.25; // How many pixels to move per step var current = 0; // The current pixel row var imageWidth = 2247; // Background image width var cloudsmallWidth = screen.width; // How wide the header is. //The pixel row where to start a new loop var restartPosition = -(imageWidth); function scrollBg2(){ //Go to next pixel row. current -= step; //If at the end of the image, then go to the top. if (current == restartPosition){ current = 0; } //Set the CSS of the header. $('#cloudsmall').css("background-position",current+"px 0"); } //Calls the scrolling function repeatedly var init = setInterval("scrollBg2()", scrollSpeed);