估算可用浏览器面积的好方法 [英] Good way to estimate available browser area

查看:65
本文介绍了估算可用浏览器面积的好方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出估算浏览器可视区域最大尺寸的最佳方法.也就是说,屏幕尺寸减去工具栏,书签等的尺寸.显然,对于窗口未最大化的情况,由于人们实际上使用不同的浏览器,这将不是完美的选择-我只是在这里寻找一个不错的估计. /p>

目的是找出图像的最大尺寸.

解决方案

您还可以使用 jQuery的 width()函数可用于任何内容:$(window).width().但是请记住,如果调整窗口的大小,这将发生变化,并且可能会改变其最初基于的布局.您可以监视该事件,但是如果您做复杂的事情,那可能会损害性能.

I'm trying to figure out the best way to estimate the maximum size of the browser viewable area. i.e. the screen dimensions less toolbars, bookmarks, etc. Obviously it wont be perfect for cases when the window isn't maximized and due to the fact that people do actually use different browsers - I'm just looking for a good estimate here.

The purpose is to then figure out the maximum size for an image.

解决方案

You can also use jQuery's width() function on anything: $(window).width(). Keep in mind though that if the window is resized, this will change and will probably through off whatever layout it was originally based on. You can watch for that event, but that could hurt performance if you're doing complicated things.

这篇关于估算可用浏览器面积的好方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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