I've been trying to use Jquery Animate and CSS however I cannot seem to get it to work;
$(function() {
var navShrink = $("#nav-anim");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 500) {
navShrink.removeClass("navigation").addClass("nav-shrink");
} else {
navShrink.removeClass("nav-shrink").addClass("navigation");
}
});
});
css;
#nav-anim {
transition: height 1s ease;
}
.navigation {
height: 12.5vh;
}
.nav-shrink {
height: 7!important;
}
html but ive left out all my content
<div id="nav-anim" class="row navigation fixed-top no-gutters">
</div>
This code works, it shrinks the height of my navigation bar after 500px. However it has no transition. I just want to ease the height change. Each class it is changing to has a different "height" property set.
Wondering if there's a way to do this without jquery ui.