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;
} ;
此尺寸的问题不会刷新更改介质。 iphone风景和肖像
答案 0 :(得分:0)
使用函数onorientationchange
window.onorientationchange = function(){
//Your Code
}
另外,要检测landscape mode
或potrait mode
,您可以尝试此操作
var screenWidth = window.innerWidth;
var screenHeight = window.innerHeight;
if(screenWidth>screenHeight)
{
alert('landscape mode');
}
else
{
alert('potrait mode');
}