js 或 jquery 实现在div的动态浮动效果

2025-05-01 04:49:17
推荐回答(2个)
回答1:

你说的这个不是浮动定位吗?

position:fixed;bottom:0; left:0; width:100%;

$(document).scroll(function(){
    if ($(window).scrollTop() > 465){
        $('.nav-top').css({
            position: 'fixed',
            top: '0',
            left:'0',
            width:'100%',
        });
    }else{
        $('.nav-top').removeAttr('style')
    }
})

回答2:

你说的这个不是浮动定位吗?

position:fixed;bottom:0; left:0; width:100%;

你说的什么div1的底部消失在浏览器底部不明白是什么意思。