jquery和css3 如何?航欄到底部上移(代碼)

來源:互聯網
上載者:User
本篇文章分享給大家的內容是關於jquery和css3 如何?航欄到底部上移(代碼),內容很詳細,接下來我們就來看看具體的內容,希望可以協助到有需要的朋友。

導覽列

.navigation {    position: fixed;    bottom: 100px;    right: 100px;    z-index: 100;}.navigation {    transition: bottom 2s;    -webkit-transition: bottom 2s;}

JQ代碼

var nav = eval($('.navigation').offset().top - $(window).scrollTop());$(window).on('scroll', function() {    var navh = $('.navigation').height();    var foot = parseInt($('.footer').offset().top - $(this).scrollTop() - navh);    /*console.log(nav - foot);*/    if(nav == foot || nav > foot) {        $('.navigation').css({            'position': 'fixed',            'bottom': '400px'        });    } else {        $('.navigation').css({            'position': 'fixed',            'bottom': '100px'        });    }});
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.