简体   繁体   中英

Trouble getting viewport size with overflowed images using jQuery

I've been stuck on this annoying bug for a couple hours now. I need to get the viewport of the browser window (specifically, just the height of the visible region in the browser). Looking around, I found that jQuery can do this:

$(window).height()

This value is accurate when I first load the page, but with my site I'm working on, if I resize the browser window, $(window).height() now becomes the height of the entire document (which includes the nonvisible section. I simplified my site so that it demonstrates the problem I'm running into . Make sure the images are overflowing off the page to demonstrate my issue.

明确指定固定的文档类型

<!DOCTYPE html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM