0

アコーディオンを iPhone だけで動作させるより良い方法はありますか?

$(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")
    })
}
});
4

1 に答える 1

1

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){
   ...
}
于 2012-06-15T09:54:07.583 に答える