其实主要是通过window.orientation实现,下面看下代码吧 代码如下:function orient() {if (window.orientation == 90 || window.orientation == -90) {//ipad、iphone竖屏;Andriod横屏$(“body”).attr(“class”, “landscape”);orientation = ‘landscape’;return false;}else if (window.orientation == 0 || window.orientation == 180) {//ipad、iphone