user3024007
user3024007

Reputation: 283

Setting jQuery offset().top

How do I set y location using jQ offset().top?

$(#ele).offset().top = 123

Do I need to include 'px' or other appropriate unit in there?

Upvotes: 1

Views: 7525

Answers (1)

Aurélien Gasser
Aurélien Gasser

Reputation: 3120

From the jQuery documentation

.offset( coordinates )

coordinates: An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.

The properties top and left are integers, you don't need to include the 'px' unit

$("#ele").offset({ top: 123 });

Upvotes: 5

Related Questions