window.onload = function() {
//set position of background overlay in section4
$('.overlay-wrap4').css('top', $('#section4').offset().top + "px");
$('.overlay-wrap4').css('height', $('#section4').height() + "px");
}
window.onresize = function() {
console.log("well called")
$('.overlay-wrap4').css('top', $('#section4').offset().top + "px"); //where I put a comment
$('.overlay-wrap4').css('height', $('#section4').height() + "px");
}
When the document is all loaded, it successfully executes the 2 lines above, but when the windows is resized, it does not executes the instruction where I put a comment. But if I copy paste it into the console, it does well the action So why is it not executed inside the onresize function when I resize the window ? The console log well called is well executed