reverse of .animate on scroll
hello.
i want to scale down my navbar on scrolling down and animate it back to normal by scrolling up.
The first step works perfect, but i don't get it resetted.
Any help appreciated,
snote
- $(function () {
- var lastScrollTop = 0;
- var $navbar = $('.navbar');
- $(window).scroll(function(event){
- var st = $(this).scrollTop();
- if (st > lastScrollTop) {
- $navbar.animate({
- right: '10px',
- width: '150px'
- }, 2000, "linear");
-
- } else {
- $("navbar").removeClass("animate")
- }
- lastScrollTop = st;
- });
- });