I am trying to scroll an image with jquery from one point to another with jQuery
I am using the following code but cannot seem to get it to work
PHP Code:
var pos = $window.scrollTop(); //position of the scrollbar
var windowHeight = $window.height(); //get the height of the window
function test(startPos, endPos, scrollPos, windowHeight)
{
var obj = $('#ios');
var position = obj.position();
console.log(position.top + (startPos - endPos)/ (scrollPos/100))
return (position.top + (startPos - endPos)/ (scrollPos/100))
}
$ios.css({'top':test(500, 120, pos, windowHeight) });
Nothing moves though. Can anyone give me a hint. TO be honest I am so turned around I don't know if I am anywhere close anymore