That line should be:
   $('#div').animate({top:parseInt($('#div').css('top'))+50},400);


In your line:
   $('#div').animate({top:parseInt($(this).css('top'))+50},400);

$(this) will work but it refers to another object.
It's the object from the current function scope.

If your line is placed inside $(document).ready(function() {}, then $(this)
will refer to the document.

if your line is placed inside a function like:
$("p#someId").click(function(){
   // ...
}

$(this) will refer the paragraph that has the id "someId".





On 3/8/08, jquertil <[EMAIL PROTECTED]> wrote:
>
>
> been reading other posts about $(this) and what it refers to.
>
> And still I dont understand.
>
> I thought $(this) is a refernce to the object I am operating on, no?
>
> So this (no pun intended, tee hee) should work ,I thought:
>
> $('#div').animate({top:parseInt($(this).css('top'))+50},400);
>
> because my absolute-positioned element $('#div').css('top') definitely
> returns '100px'. and the parseint returns, as expected, '100'
>
> what gives? what am I missing?
>



-- 
http://jquerybox.com - jQuery forum

Reply via email to