Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2012
    Location
    UK
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    jquery, scrolling

    Hi!

    on a jquery trigger, i want to add more margin-left pixels to how it it is currenty.
    to lets say i have a div, and it is 350px left, and on the jquery trigger, i want it to animate a further pixel,
    the trigger is scrolling, so as i scroll, the div moves further along.

    $(window).scroll(function(){
    ("#div").animate({ marginLeft: "+1px"}, 1);
    });



    ...does not work, i guessed it.


    $(window).scroll(function(){
    alert("scrolled");
    });


    ..does work, (just proving that the trigger works).

    Any help would be appreciated!
    Last edited by wylie233; 12-03-2012 at 05:38 PM.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    I think you should use +=1px


  •  

    Posting Permissions

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