jquery - Issue with offset top on chrome -


i issue òffset().top property in jquery. works on every browsers except chrome.

i'm working on table, offset().top on cells...

my code :

var topofcell = $('td').offset().top; var bottomofcell= $('td').offset().top + $('td').outerheight(); 

result on chrome :

enter image description here

result on firefox, ie, ect...

enter image description here

offset() method gets position relative document , may vary browsers browsers, using position() method solve problem gets position relative parent offset. , should apply css position in parent element.

so, try using position() method

or, may offset top getting value before content loaded try using on ready:

$(document).ready(function(){ //do stuff here }); 

or, try using on window load function:

window.onload = function(){ //do stuff here } 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -