In my case, the code snippet below modifies the size of my navbar as I scroll down and back up: The original height is 15vh while the smaller navbar height is set to 8vh
$(document).ready(function($){
var nav = $('nav');
$(window).scroll(function () {
if ($(this).scrollTop() > 13.35) {
nav.addClass("smallnav");
} else if($(this).scrollTop() > 0) {
nav.removeClass("smallnav");
}
});
});
Currently, the transition from small to big or vice versa happens instantly. How can I introduce an animation effect so that it smoothly shrinks or expands?