Home > Web Front-end > CSS Tutorial > 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)

不言
Release: 2018-07-26 11:50:58
Original
1698 people have browsed it

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;
}
Copy after login

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template