开发者

Hooking into browser rotation

I'd like to execute some JavaScript code when the mobile phone is rotated.开发者_JAVA百科 I'm using jQuery. Is there a custom hook I can use with mobile browsers?

One way I can think of is hooking into the change of the viewport size, and checking if the height/width ratio has changed. Is there an API method that I could use instead?


it should be "onorientationchange" event attached on <body> tag.

Looking at window.orientation property you should also get the angle in degrees.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜