Moving an object/element in Parallax
Hey guys,
I've visited a few Parallax demos that illustrate how to move background images across the screen with jQuery and a simple script similar to the following....
-------------
// speed in milliseconds
var scrollSpeed22 = 60;
// set the default position
var current22 = 0;
// set the direction
var direction22 = 'h';
function bgscroll22(){
// 1 pixel row at a time
current22 -= 1;
// move the background with backgrond-position css properties
$('div.item1').css("backgroundPosition", (direction22 == 'h') ? current22+"px 0" : "0 " + current22+"px");
}
//Calls the scrolling function repeatedly
setInterval("bgscroll22()", scrollSpeed22);
------------
The CSS for this is simply to call a background image and set the background-repeat property to "repeat-x".
Was curious if there was an easy way to move an object across the screen without it having to be a background image.
Thanks in advance....