Recently, I've developed a script that dynamically calculates and updates the height of a DIV based on the scrollTop value.
var scroll = $(this).scrollTop();
console.log(scroll);
function adjustHeight() {
document.getElementById("overlay").style.height = scroll + 'px';
}
document.getElementById("overlay").addEventListener("scroll", adjustHeight());
However, I'm encountering an issue where the style only updates when I refresh the page even though I need it to continuously update (I'm building a progress bar).
Thank you in advance for any assistance provided!
(My apologies if I didn't adhere to the correct question format for this platform, this is my first time posting here :L )