Instead of using position() , as in your example:
var link = $('#mymenu a'); var tooltip = $('#mymenu #tooltip'); link.click(function(){ tooltip.css('left', $(this).position().left); });
you can use the subtraction of the offset() element with the offset() its parent (not necessarily the closest parent):
var parent = $('#mymenu'); var link = $('#mymenu a'); var tooltip = $('#mymenu #tooltip'); link.click(function(){ parent.css('position', 'relative'); tooltip.css('left', $(this).offset().left - parent.offset().left); });
It returns the same value as position() , but works correctly in both FF and Chrome.
source share