JavaScript调整大小事件滚动 - 移动 [英] javascript resize event on scroll - mobile

查看:138
本文介绍了JavaScript调整大小事件滚动 - 移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作移动网站。我在窗口上绑定了resize事件,当移动设备正在转动(肖像< - >风景)时,应该重新排列元素。在iPhone和Samsung Galaxy SII上,当我向下滚动页面时,触发事件,这不是很好。



任何建议?

解决方案

使用 onOrientationChange 事件和 window.orientation 属性。



另请参阅此答案



这里将链接到测试页


I'm trying to make a website for mobile. I'm having the "resize" event binded on window, wich should rearrange elements when the mobile device is turning (portrait <-> landscape). On iPhone and Samsung Galaxy SII, the event is triggered when I'm scrolling down the page, and that's not good.

Any suggestions?

解决方案

Use the onOrientationChange event and the window.orientation property instead.

Also see this answer.

Here link to a test page.

这篇关于JavaScript调整大小事件滚动 - 移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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