Home  >  Article  >  Web Front-end  >  How to move the navigation bar to the bottom with jquery and css3 (code)

How to move the navigation bar to the bottom with jquery and css3 (code)

不言
不言Original
2018-07-26 11:50:581660browse

The content shared with you in this article is about how jquery and css3 realize the movement of the navigation bar to the bottom (code). The content is very detailed. Next, let’s take a look at the specific content. I hope it can help those in need. friend.

Navigation bar

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

JQ code

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'
        });
    }
});

Related recommendations:

How Css Sprite implements image stitching technology

How to use css and js mobile terminals to determine the status of the mobile phone's horizontal and vertical screens respectively

The above is the detailed content of How to move the navigation bar to the bottom with jquery and css3 (code). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn