How do you make this function animated?



  • How do you make this function animated?

    $(function() {
        $(window).scroll(function() {
            if($(window).scrollTop() > 100) {
                $(".header").css({
                    width: "100%",
                    position: "fixed"
                })
            } else {
                $(".header").css({
                    width: "auto",
                    position: "relative"
                })
            }
        });
    });
    


  • $(function() {
        $(window).scroll(function() {
            if($(window).scrollTop() > 100) {
                $(".header").animate({
                    width: "100%",
                    position: "fixed"
                },5000);
            } else {
                $(".header").animate({
                    width: "auto",
                    position: "relative"
                },5000);
            }
        });
    });
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2