本篇文章分享给大家的内容是关于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'
});
}
});相关推荐:
立即学习“前端免费学习笔记(深入)”;
以上就是jquery和css3 如何实现航栏到底部上移(代码)的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号