Home > Article > Web Front-end > How to move the navigation bar to the bottom with jquery and css3 (code)
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
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!