I\'m trying to get an element\'s CSS (top and left) with jQuery:
$(element).css(\'top\');
but instead of \"12%\" like it should be, I get the p
There is a (very easy) way to do this!
Even when using stylesheets.
The key is to prevent jquery from calculating the value by temporarily hiding the parent.
$(element).parent().hide();
var top = $(element).css("top");
$(element).parent().show();
console.log(top);
voila!
If you want just the number without the "%" use
top = parseFloat(top);
BTW: Don't worry, the hiding and reshowing is so quick, it won't be visible for your users.