我可以使用jquery确定设备是处于纵向还是横向模式? [英] Can I determine if a device is in portrait or landscape mode using jquery?
本文介绍了我可以使用jquery确定设备是处于纵向还是横向模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想根据用于查看网站的设备是纵向/纵向还是横向/横向模式/方向,有条件地改变用户在我要创建的照片库网站上看到的内容。这可能吗?
I want to conditionally alter what the user sees on the photo gallery web site I'm going to create based on if the device being used to view the site is in portrait/vertical vs. landscape/horizontal mode/orientation. Is this possible?
推荐答案
尝试 orientationchange
事件处理程序,类似于这个:
Try the orientationchange
event handler, something like this:
$(window).bind("orientationchange", function(evt){
alert(evt.orientation);
});
这是 jQuery Mobile条目,用于检测并触发 orientationchange
事件。
Here's the jQuery Mobile entry on detecting and firing the orientationchange
event.
这篇关于我可以使用jquery确定设备是处于纵向还是横向模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文