当视口大小更改时自动刷新页面 [英] Refreshing page automatically when viewport size change

查看:225
本文介绍了当视口大小更改时自动刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用响应和自适应媒体查询我的网站适应智能手机...现在的问题是,我的最大宽度移动查询结束在480像素,这是大多数手机旋转显示宽度(当手机在侧...)。现在一些手机,像HTC愿望最大屏幕宽度为533px,现在当用户首先加载页面在垂直位置(320px屏幕宽度),他/她旋转旋转屏幕到533px宽度,它超过了我的设计规格它看起来有点appy appy ...(因为布局是为480px最大...)

I'm using responsive and adaptive media queries for my website to accommodate smartphones...Now the problem is that my max-width mobile query ends at 480px, which is most phones rotated display width (when the phone is on its side...). Now some phones, like the HTC desire have a max screen width of 533px, now when the user first loads the page on vertical position (320px screen width) and he/she rotates rotates the screen to 533px width, it goes past my design specifications and it looks kinda crappy...(since the layout was meant for 480px max...)

现在唯一的办法是刷新页面一次视口尺寸更改。如何强制刷新?

Now the only way to solve that is to refresh the page once the viewport dimensions change. How do I force a refresh?

谢谢

推荐答案

if

window.onresize = function(event)
{
document.location.reload(true);
}

这篇关于当视口大小更改时自动刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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