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

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -