.width() reflow and repaint. DOM . HTML- .
.width() (0) , .
.width() reflow-and-repaint.
№1. Windows
$(document).ready(function(){
});
$(document).ready DOM . , . , , .width()= 0
$(window).load(function(){
});
$(window).load DOM , .
№2. VS
HTML
<div style="display:none">
<button>Foo</button>
</div>
JQuery
$('button').width();
$('div').show();
$('button').width();
, , .width() reflow-and-repaint.
source
share