基于移动定位改变CSS [英] Change CSS Based on Mobile Orientation

查看:56
本文介绍了基于移动定位改变CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当移动应用程序页面方向从横向更改为纵向时,更改css文件的最佳方法是什么,反之亦然。我只需要支持Android和iPhone。似乎媒体查询不是最干净的方式,任何其他想法?

What is the best approach to change a css file when a mobile application page orientation changes from landscape to portrait and vice versa. I need to suport both Android and iPhone only. It seems media queries aren't the cleanest way, any other ideas?

推荐答案

下面的JQuery代码似乎对我来说效果最好......绑定的例子没有。

The below JQuery code seems to work best for me...the binding examples did not.

$(document).ready(function() {
               $(window).resize(function() {
                  alert(window.orientation);
                  });
               });

这篇关于基于移动定位改变CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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