Reputation: 1
How do i disable my jquery horizontal slider in portrait mode? Its driving me nuts, because i dont know any javascript, so i have no idea how to do it.
Thanks already, Wouter
-edit-
Here is the Javascript:
Javascript
Upvotes: 0
Views: 616
Reputation: 5094
Here is a solution from 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.
Upvotes: 3