避免网页中水平滚动的Javascript [英] Javascript for avoiding horizontal scroll in web pages

查看:96
本文介绍了避免网页中水平滚动的Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

:omg:如何避免通过javascript在网页中进行水平滚动;我的意思是脚本将根据客户端计算机上可用的分辨率自动调整屏幕分辨率?

:omg: How can I avoid horizontal scroll in web pages through javascript; I mean the script will automatically adjust the screen resolution according as the resolution available on client machine?

推荐答案

我对此表示怀疑.您无法调整客户端系统的屏幕分辨率-如果允许的话,这将是一个很大的安全漏洞!

您可以做的是,使用Javascript根据屏幕分辨率调整浏览器.
您可以随时执行以下操作:
I doubt that. You cannot adjust the screen resolution of client system - that would be a big security hole, which if allowed!

What you can do is, adjust your browser according to the screen resolution using Javascript.
You can always do something like this:
if ((screen.width < 1024) && (screen.height < 768))
{
    alert('Your screen resolution is less than 1024x768; this site is best viewed at 1024x768 resolution!!!')
}



看看此博客条目 [根据问题进行的类似讨论-1 [根据问题进行的类似讨论-2 [ ^ ]

如果需要,有很多讨论线程



Have a look at this blog entry[^] discussing the similar thing.

Also look at these threads:
Similar discussion as per question - 1[^]
Similar discussion as per question - 2[^]

If needed, there are quite a lot of discussion threads here.[^]


这篇关于避免网页中水平滚动的Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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