如何在纵向模式下禁用我的 jquery 水平 slider ? 这让我抓狂,因为我不懂任何 javascript,所以我不知道该怎么做。
已经谢谢了 沃特
-编辑-
这是Javascript:
Javascript
最佳答案
这是来自 David Walsh 的解决方案:
window.addEventListener("orientationchange", function() {
if(window.orientation == 0 || window.orientation == 180){ //this is portrait
//disable the slider here.
}
else{
//enable the slider here
}
}, false);
During these changes, the window.orientation property may change. A value of 0 [or 180] means portrait view, -90 means a the device is landscape rotated to the right, and 90 means the device is landscape rotated to the left.
关于javascript - 在纵向模式 iPad/iPhone 中禁用 Jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13093672/