change height of div with scroll in javascript

Solutions on MaxInterview for change height of div with scroll in javascript by the best coders in the world

showing results for - "change height of div with scroll in javascript"
Miracle
25 Nov 2019
1$(window).on('scroll', function () {
2    var scrollTop = $(window).scrollTop();
3    if (scrollTop > 50) {
4        $('#header_parent').stop().animate({height: "30px"},200);
5    }
6    else {
7         $('#header_parent').stop().animate({height: "50px"},200);   
8    }
9});