Reputation: 85056
Basically I would like to do something like this:
$("#whatever").css("bottom", "-=40");
$("#whatever").css("top", "+=40");
I saw an example on jQuery's website where they did this with the width, but when I tried it with bottom and top it didn't work.
Can this be done with jQuery?
Upvotes: 2
Views: 80
Reputation: 227270
It works fine in jQuery 1.6.2. Your jsFiddle was incorrect.
You selected MooTools, not jQuery. Also, #down
was not an element.
Corrected fiddle: http://jsfiddle.net/TUyLs/11/
Upvotes: 0
Reputation: 5229
it works, you had some other errors and you were using MooTools
Upvotes: 0
Reputation: 8346
Try this: http://jsfiddle.net/TUyLs/3
Yes, it work's. Make sure to insert jQuery (you inserted mootools). Also the element needs to be positioned absolute, in ordner to use top and left. Without declaring it as absolute, it'll be static, which means you won't be able to position it static.
// BTW, just a tip: You don't need to use document.ready on jsfiddle in your example. JSfiddle is inserting that automatically. (Under 'use framework': 'onLoad')
Upvotes: 4