javascript - 在纵向模式 iPad/iPhone 中禁用 Jquery

标签 javascript jquery html css

如何在纵向模式下禁用我的 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/

相关文章:

javascript - element.css ('left' ) 返回 'auto' 即使它不在 iPhone Safari 上

javascript - 在 Javascript 中调用时类名不起作用?

javascript - JQuery 删除字符串之前的文本

javascript - HTML类和CSS样式表之间的不理解

java - 如何将 HTML 表单提交重定向到 iframe?

css - 我可以用 CSS 得到这些弯 Angular 吗?

javascript - 提交后启用提交按钮

javascript - 如何强制 jquery $.when(...) 失败

javascript - 如何让 jQuery 自动完成在用户点击提交时执行 search()

jQuery 在日期中添加天数