tags:

views:

30

answers:

1

I have one image. i want that when someone scrolls the browser window then by jquery i should also change the image position from top as well

I want to use jquery only . Is there function like that.

I don't want to use position:fixed or something like that. I want something like

onScroll(){
var x = getScrollDIstance();
moveImageDown(x);

}
A: 

Keeping with your requirement of not using position:fixed, you can do the following with jQuery:

$(window).scroll(function()
{
  $('#your-image').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});
});
JD Courtoy