gpt4 book ai didi

jquery - 在页脚 Jquery 停止 float

转载 作者:太空宇宙 更新时间:2023-11-04 13:07:34 26 4
gpt4 key购买 nike

我正在使用这段代码:

  $(window).scroll(function () {
if (($(document).height() - $(window).scrollTop()) <= 500){
$("#content-5").css({
position: 'fixed',
top: 'auto',
bottom: '300px'
});
} else if ($(window).scrollTop() >= 30) {
$("#content-5").css({
position: 'fixed',
top: '30px',
bottom: 'auto'
});
}else{
$("#content-5").css({
position: 'absolute',
top: '30px',
bottom: 'auto'
});
}

});

这是演示

http://jsfiddle.net/Ym2Ga/75/

它工作正常,但我不知道该怎么做, float 元素停在页脚处。谁能帮忙?

最佳答案

我已经更新了你的 fiddle ......将你的第一个 css block 更改为......

$("#content-5").css({
位置:'固定',
顶部:'0px',
底部:'自动'
});

fiiddle

关于jquery - 在页脚 Jquery 停止 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24980340/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com