如何在javascript和/或php中获取访问者的屏幕分辨率? [英] How to get screen resolution of visitor in javascript and/or php?

查看:130
本文介绍了如何在javascript和/或php中获取访问者的屏幕分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道访问我网页的访问者的屏幕分辨率,因此我可以正确地将jquery厚盒覆盖屏幕的大约75%。



解决方案非常感谢问题或帮助我解决我的问题!

解决方案

是什么让你觉得人们的浏览器窗口总是最大化到与他们的屏幕大小相同?我没有,而且我不是唯一一个。



你想要的是覆盖75%的窗口。这可以使用CSS完成;如果有问题的元素是body元素的子元素,那么

  #box {
position:absolute;
top:12.5%;剩余
:12.5%;
宽度:75%;
身高:75%;
}

可能会这样做(尽管我没有测试过。) / p>

编辑:我现在测试了它,添加

  html,身体{
宽度:100%;
身高:100%;
}

它按预期工作,至少在Firefox 3.5中: - )


I would like to know the screen resolution of a visitor visiting my page so I can properly make a jquery thickbox cover about 75% of their screen.

Solutions to the question or helping me solve my problem are greatly appreciated!

解决方案

What makes you think people always have their browser window maximised to the same size as their screen? I don't, and I'm not the only one.

What you want is to cover 75% of their window. This can be done using CSS; if the element in question is a child of the body element, then

#box {
    position: absolute;
    top: 12.5%;
    left: 12.5%;
    width: 75%;
    height: 75%;
}

will probably do it (I've not tested it, though).

EDIT: I've now tested it, adding

html, body {
    width: 100%;
    height: 100%;
}

and it worked as expected, at least in Firefox 3.5 :-)

这篇关于如何在javascript和/或php中获取访问者的屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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