Hi, I'm making an event happening whenever I scroll(move it). The problem is that it only calls the function once, when I want it to be called multiple times. I want to make it a function, since it might be more than one object moving with the scroll. When I use the code without the function it moves multiple times. Once its in the function and called it only calls it once. Help much appreciated
Another question I just remembered. How can you pass a variable as the id/class into a css query. Like when it says: $("#cloud-1").css({marginLeft: "200px"});. Instead of #cloud-1, use $id. I tried, but unsuccessful.Code:$(document).ready(function() { $(window).scroll(function() { moveLeft("cloud-1"); }); }); function moveLeft($id){ $("#cloud-1").css({marginLeft: "200px"}); }



Reply With Quote
Bookmarks