Reputation: 7
I have the following code:
<div class="ongoing" style="width: +728px; margin-left: +12480px">
and I would like to use the value of margin-left
for scrolling to a position.
I've used the below code to get the value of width
, but it's not working for margin-left
(because of the hyphen, I assume?):
$("div.ongoing")[0].style.margin-left
How can I get the margin-left
value?
Thanks!
Upvotes: 0
Views: 829
Reputation: 82231
You need to use:
$("div.ongoing")[0].style.marginLeft
or
$("div.ongoing").css("marginLeft");//or .css("margin-left");
Upvotes: 3