Reputation: 5761
Is there a better way of making an accordion work for iPhone only?
$(document).ready(function () {
var device = navigator.userAgent.toLowerCase();
var ios = device.match(/(iphone|ipod|ipad)/);
if (ios) {
$("#Main_Box_Section .box2:not(:first)").hide();
$("#Main_Box_Section h3").click(function () {
$(this).next(".box2").slideToggle("slow").siblings(".box2:visible").slideUp("slow")
})
}
});
Upvotes: 0
Views: 355
Reputation:
Taken from Zepto.js:
var ua = navigator.userAgent.toLowerCase();
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
if(iphone){
...
}
Upvotes: 1