Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-03-2012, 04:16 PM   PM User | #1
wylie233
New Coder

 
Join Date: Jul 2012
Location: UK
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
wylie233 is an unknown quantity at this point
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..
wylie233 is offline   Reply With Quote
Old 12-03-2012, 08:09 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
I think you should use +=1px
devnull69 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:59 AM.


Advertisement
Log in to turn off these ads.