position (). left returns an incorrect value for each element except the first: for example, 309 instead of 310 and each time the difference grows 1, 2, 5? how to be? When I type the same in the firebug console, the calculation is normal.

$('#nav > li .dropdown').each(function(){ var $this = $(this), width = 0, positionRight = 0, props = {'position': 'absolute', 'visibility': 'hidden', 'display': 'block'}, parent = $this.parent(), position = parent.position(), parentWidth = parent.outerWidth(true), positionLeft = position.left; jQuery.swap(this, props, function(){ $this.children('ul').each(function(){ width += $(this).outerWidth(); }); }); if (width > 0){ positionRight = 980 - positionLeft - parentWidth + 4; if (positionLeft < 600){ positionLeft = positionLeft; if ((positionRight + parentWidth) > width){ $this.css('left', positionLeft); } else { $this.css('right', 0); } } else { if ((positionLeft + parentWidth - 200) > width){ $this.css('right', positionRight); } else { if (width < 780){ $this.css('left', 200); } else { $this.css('right', 0); } } } $this.css('width', width+1); } }); 

    0