jquery:$(window).scrollTop()但没有$(窗口).scrollBottom() [英] jquery: $(window).scrollTop() but no $(window).scrollBottom()

查看:228
本文介绍了jquery:$(window).scrollTop()但没有$(窗口).scrollBottom()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当用户滚动页面时,我想在页面底部放置一个元素。这就像固定位置,但我不能使用position:fixedcss,因为我的许多客户的浏览器都不支持。

I want to place an element to the bottom of the page whenever the user scrolls the page. It's like "fixed position" but I can't use "position: fixed" css as many of my clients' browser can't support that.

我注意到jquery可以获取当前视口的顶部位置,但是如何获得滚动视口的底部?

I noticed jquery can get current viewport's top position, but how can I get the bottom of the scroll viewport?

所以我问如何知道:$(window).scrollBottom()

So I am asking how to know: $(window).scrollBottom()

推荐答案

var scrollBottom = $(window).scrollTop() + $(window).height();

这篇关于jquery:$(window).scrollTop()但没有$(窗口).scrollBottom()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆