gpt4 book ai didi

javascript - 如何将元素定位到浏览器窗口底部并仅在滚动时显示内容?

转载 作者:行者123 更新时间:2023-12-03 11:50:20 25 4
gpt4 key购买 nike

在下面链接的网站上,当调整窗口大小时, Logo 会保留在页面底部,并且在您向上或向下滚动网站之前,下面的内容不可见。这也适用于移动设备。我如何管理它以将 DIV 定位到浏览器窗口的底部,以便隐藏以下 DIV,直到您开始滚动?这是一个网站链接,准确显示了我想要重新编程的内容。

Please visit this Site as an example

提前致谢

最佳答案

CSS:

#element {
display: none;
/* and other CSS */
}

jQuery:

$(document).on("scroll", function () {
if ($(this).scrollTop() > 100) { /* change the integer to whatever you need */
$("#element").fadeIn("slow");
} else {
$("#element").fadeOut("slow");
}
});

关于javascript - 如何将元素定位到浏览器窗口底部并仅在滚动时显示内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25871480/

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