0

我有一些 jQuery,但希望它只在 iPad 处于纵向模式时运行,悬停 iPad(在横向模式下)处理脚本......

var portraitWidth = $(window).width(); //detect the iPad in Portrait orientation
    if (portraitWidth < 769) {
        $('.model-selector h2:first-child').toggle(function () {
            $(this).parent().animate({
                top: '-138px'
            }, 250);
        }, function () {
            $('.model-selector').animate({
                top: '-45px'
            }, 250);
        });
    }

我究竟做错了什么?

提前致谢..

4

1 回答 1

-1

我有同样的问题。我认为 innerWidth() 对我有用,因为 .width() 只会测试不会改变的设备的实际宽度......

于 2015-11-04T18:49:43.367 回答