var middleHeight = $(document).scrollTop() + $(window).height() / 2.0;
Yes, you can use $(window).height() for the window height and $(document).scrollTop() (space between document start and current scroll height) for calculating the middle position of the screen.
var middleHeight = $(document).scrollTop() + $(window).height() / 2.0;
发布评论
评论(1)
是的,您可以使用 $(window).height() 作为窗口高度,使用 $(document).scrollTop() (文档开始和当前滚动高度之间的空间)来计算屏幕的中间位置。
Yes, you can use $(window).height() for the window height and $(document).scrollTop() (space between document start and current scroll height) for calculating the middle position of the screen.