0
function getItemWidth(){
    var slide_wi = 976;

    var window_width = $(window).width();

    if(window_width < 350){
        slide_wi = 300;
    }else if(window_width <= 568){
        slide_wi = 458;
    }else if(window_width <= 800){
        slide_wi = 746;
    }else if(window_width >= 1152){
        slide_wi = 976;
    }
    return slide_wi;
} ;

这种尺寸的问题不能解决 ex 更换媒体的问题。iphone landsace 和 potratie

4

1 回答 1

0

使用功能onorientationchange

window.onorientationchange  = function(){
    //Your Code 
}

也检测landscape modeor potrait mode,你可以试试这个

var screenWidth = window.innerWidth;
var screenHeight = window.innerHeight;
if(screenWidth>screenHeight)
{
    alert('landscape mode');
}
else
{
    alert('potrait mode');
}
于 2013-03-05T10:06:13.293 回答