Reputation: 2343
I have an issue on a site, I think is a CSS issue, but really can't figure it out.
I'm using jQuery to get the position of a div image container. When the mouse hovers on it, a hidden form should appear, relative to the div image container. The hidden form popups correctly, but in the wrong position, like if offset() got wrong values.
This is the JS jQuery code (id is a parameter of my js function)
var currentTarget = jQuery(id);
var pos = currentTarget.offset();
container.css('top', parseInt(pos.top) + 'px');
container.css('left', parseInt(pos.left) + 'px');
And this is the site http://www.disegnosis.com.ar/rentalstation/
Thanks alot in advise
Upvotes: 0
Views: 1671
Reputation: 34556
You cannot read offset coordinates of hidden elements.
The common workaround is to momentarily make the element visible, grab the offset coordinates, then hide it again.
Upvotes: 1