<html> <head> <meta charset="UTF-8"> </head> <body onload="javascript:res(0,0,0,0)"> <script type="text/javascript"> function res(width, height, timeout, validation) { var item = document.getElementById('test_two'); if((width == item.offsetWidth) && (height == item.offsetHeight)) { if(validation) { // , . // document.getElementById('test').innerHTML = Date(); } else { timeout = 500; } window.setTimeout(res, timeout, width, height, timeout, 0); } else { width = item.offsetWidth; height = item.offsetHeight; timeout = 200; window.setTimeout(res, timeout, width, height, timeout, 1); } } </script> <div id="test"></div> <div id="test_two"><p>Test JavaScript.</p></div> </body> </html>
Source: https://habr.com/ru/post/312536/
All Articles