Answers for "change height of div with scroll in javascript"

0

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);   
    }
});
Posted by: Guest on February-18-2021

Code answers related to "change height of div with scroll in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language