我目前正在使用一些js来检测何时到达我正在开发的站点的页面底部。我目前正在使用下面的脚本测试js:
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height() ){
console.log('you are at the bottom');
}
});
我这里的问题是,它只在我滚动页面的顶部时触发,而不是底部,这不是我想要的效果。
有没有人知道为什么它不能工作?
谢谢,马克
我有一个添加更多附件的函数。每次单击该按钮,都会显示另一个附件,这将导致页面变得更长。我写了一个语法来检测附件出现后身体的高度,但不知怎么的,它不起作用。请帮帮忙。
HTML
<input type="file" /></div><button id="addNew">Add</button>
<div class="attachField"></div>
JS
var i=0;
$('#addNew').click(
f
我在这里使用这个效果:https://tympanus.net/codrops/2019/03/12/image-distortion-effects-with-svg-filters/ https://codepen.io/furkanyildiz/pen/bGwebmR <div style="height:5rem;">
this div disrupts the render location of images </div>
<main>
<div class="content">
我试图检测用户何时滚动到页面的最底部。
我最后得到的解决方案如下
var windowHeight = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
var body = document.body, html = document.documentElement;
var docHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollH
我有两个div实例,一旦到达scrollTop,它们就会从相对位置转换为固定位置。然而,我正在寻找一种方法来关闭一个功能,一旦一个脚注div滚动到。如果您查看此页面上的侧栏,您可以更好地理解我想要实现的目标,
一旦页面到达底部页脚div,我需要将侧边栏设置回位置:相对,以便它不会覆盖页面的其余部分,并能够随着内容部分向上滚动。
下面是我正在使用的当前jQuery脚本。任何帮助或建议都是非常感谢的!
<script>
$(function() {
// grab the initial top offset of the navigation
var sticky