iPhone accelerometer in web applications

2020-07-30 00:14发布

问题:

I want my website to change its layout according to the device positon. The site has 2 layout types: vertical(height > width) ang horizontal(width > height).

do you see any solution?

upd: I don't see any complexity in changing the site layout. I want to know is there any event to handle. p.s. will iphone's browser change its orientation if i rotate the device 90 degree? Dave, tnx for emendation.

回答1:

There is a javascript event called onorientationchange sent when the orientation changes and also there is a property called orientation on the window object that tells what the current orientation is.

See the documentation for more info and sample.



标签: iphone