在iPad纵向模式下查看时如何自动重新加载页面? [英] How to do automatic reload of page when viewed in iPad Portrait mode?

查看:293
本文介绍了在iPad纵向模式下查看时如何自动重新加载页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个wordpress网站,目前正致力于网站的响应能力。在横向模式下查看的网站看起来很好。但是当它的方向改变为纵向模式(垂直)时,网站上的不同小部件会中断或被切断到最右边。

I have a wordpress site and working on the responsiveness of the site currently. The site when viewed in landscape mode looks fine. But when it's orientation is change to portrait mode (vertical) the different widgets on the site break or get cut off to extreme right.

然而,在页面刷新后(垂直)模式所有小部件显示正常,并且网站通常正确呈现。似乎CSS / JS没有加载或无法检测方向更改,直到刷新完成。

However after a page refresh in portrait (vertical) mode all widgets show up fine and the site in general renders correctly. Seems like the CSS/JS is not loading up or unable to detect the orientation change until a refresh is done.

不能指望用户重新加载以获得正确的以纵向模式查看。有没有办法重新加载所有CSS / JS或只是对方向更改进行自动页面刷新?

Can't expect the users to reload to get the proper view in portrait mode. Is there a way to reload all CSS/JS or just do an automatic page refresh on orientation change ?

遇到一个线程,其中一些建议以下内容添加到< head> 代码

Came across a thread where some one suggested the following to add to <head> tag

 <meta name = "viewport" content = "initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">

我是Wordpress的新手所以不知道在哪里以及如何添加这个以便所有页面会占用这个效果。也不确定上述是否会起作用或者是否还有其他我可以尝试的东西。

I'm a novice to Wordpress so don't know where and how to add this so that all pages take up this effect. Also not sure if the above would work or is there some thing else I could try.

欢迎任何建议,因为我不知道如何解决这个问题。

Any suggestions are welcomed as I have no idea how to sort this problem out.

非常感谢提前

推荐答案

检测并重新加载:

<script>
window.onorientationchange = function() { location.reload() };
</script>

这篇关于在iPad纵向模式下查看时如何自动重新加载页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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