Results 1 to 2 of 2

Thread: JQuery function only calls once

  1. #1
    Join Date
    Jun 2012

    JQuery function only calls once

    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

    $(document).ready(function() {
        $(window).scroll(function() {
    function moveLeft($id){
        $("#cloud-1").css({marginLeft: "200px"});
    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.
    Last edited by Jonas!; 07-17-2012 at 12:31 AM.

  2. #2
    Join Date
    Jun 2012
    I found the error. It was my mistake, in some code that wasn't here. The variable didn't change. Sorry for the inconvenience for whoever tried.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center