0

I am trying to get css property top value for particular element using Jquery like below:

var topvl1 = $("#top1").css( "top" );

if I set css property top value as pixels , then I can get value. if I set css property top as percentage , then I can't get value there so value as 0.

how can i get css percentage value in jquery, please solve this issue

i have change my code link and here not working please check: http://jsfiddle.net/ZnGks/4/

advance thanks

  • You can't get values in percentage you can set it in css but js would return you the calculated values depending the screen. – Jai Apr 11 '14 at 12:29
  • But in example is using 'width', you should change to 'top' – brunozrk Apr 11 '14 at 12:34
  • @Avinafh please do not try to edit questions to comment on the fact that they're duplicates. Flag as a duplicate instead. – Wooble Apr 11 '14 at 12:43
  • @brunozrk i have change my code link this, please fix my issue dude, i think all didn't unsterstand my problem [http://jsfiddle.net/ZnGks/4/](http://jsfiddle.net/ZnGks/4/) – Senthilkumar Govindasamy Apr 11 '14 at 13:03
  • @brunozrk: no dude, this is not working in safari, i am getting 0 top value for #workpage id, but i put value as top: 50%; in css, please check http://jsfiddle.net/ZnGks/4/ – Senthilkumar Govindasamy Apr 11 '14 at 13:20

0 Answers0