【问题标题】:Bounce/Ease animation for nav bar when scrolling滚动时导航栏的弹跳/缓动动画
【发布时间】:2016-02-15 15:56:44
【问题描述】:

任何人都知道当用户不在页面顶部时,该网站如何将导航栏弹回顶部?

http://whois.domaintools.com/

这是我目前得到的。

if(scrollTop > 0){
                console.log(scrollTop);
                if(nav.hasClass('navbar-static-top')){
                    nav.removeClass('navbar-static-top').addClass('navbar-fixed-top');
                }
            } else {
                if(nav.hasClass('navbar-fixed-top')){
                    nav.removeClass('navbar-fixed-top').addClass('navbar-static-top');
                }
            }

这可行,但我似乎无法获得反弹效果:( 有人有什么想法吗?

谢谢大家:)

【问题讨论】:

    标签: javascript jquery css jquery-animate navbar


    【解决方案1】:

    CSS transition-timing-function 属性的值为 ease-in

    更多:https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function

    这是一个演示:https://jsfiddle.net/os1Ld8fj/1/

    【讨论】:

    • 非常感谢你真棒。我花了过去三个小时在这上面。非常感谢你:))
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-29
    • 2020-03-08
    • 2015-06-14
    • 1970-01-01
    相关资源
    最近更新 更多