2012-10-13 27 views
0

我有一些jQuery的,但希望它只能运行当iPad处于纵向模式时,将鼠标悬停在iPad(横向模式)处理脚本...检测的iPad在纵向与jQuery

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); 
     }); 
    } 

我究竟做错了什么?

在此先感谢..

回答

-1

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