This is just a noob question that I am sure anybody here will be able to help me with :). I was trying to do the following statement without success.
- $(document).ready(function() {
- $('.my-object').css({
- 'top': $(this).height()
- });
- });
When I do this the object moves to the height of the document not the ".my-object" object.
After a bit of reading I figure it is because the $(this) object wil only work on a function that triggers an event or something like that. The quest is... How can I do this without having to make refference to ".my-object" twice?
I thought somthing like this:
- $(document).ready(function() {
- $('.my-object').function() {
- $(this).css({
- 'top': $(this).height()
- });
- }
- });
This is obviously not valid syntax... So what functions or syntax should I use to achive this?