Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js - change div height on scroll

var header = document.getElementById("header_parent");

window.onscroll = function(e) {
    if(window.scrollY) {
        if(window.pageYOffset > 50) {
            header.style.height = 30;
        } else {
            header.style.height = 50;
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #change #div #height #scroll
ADD COMMENT
Topic
Name
8+5 =