Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change height of div with scroll in javascript

$(window).on('scroll', function () {
    var scrollTop = $(window).scrollTop();
    if (scrollTop > 50) {
        $('#header_parent').stop().animate({height: "30px"},200);
    }
    else {
         $('#header_parent').stop().animate({height: "50px"},200);   
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #height #div #scroll #javascript
ADD COMMENT
Topic
Name
9+5 =