2

私はjquery-mobileを使用していますが、それはランドスケープ設定を検出しないようです。私は何を使用しています:jquery mobile orientation detection

iphoneシミュレータバージョン4.3(238.2)私は私のmobile.js

$(window).bind('orientationchange resize', function(event){ 
    alert(event.orientation) 
}) 

とシミュレータを回すことでこれを実行しようとしました

モバイルXcodeのバージョン4.1ビルド4B110 jqueryのからちょうど私が「肖像」と明記しているのは、それが明らかに風景でなければならないときです。

ここで何か問題がありますか?私はまた、私たちのジャム通話でメディアクエリを使用しようとしました:

<%= include_stylesheet :landscape, :media => "all and (orientation: landscape)" %> 

しかし、役に立たないです。 AM私はここで何か間違っている?

主なバグbtwは、iphoneを回しても表示がまだ私たちのためにポートレートの幅にとどまっているということです。

+0

ます。http: //jquerymobile.com/dem os/1.0b2 /#/ demos/1.0b2/docs/api/mediahelpers.html注:この機能はベータ版では廃止され、その後削除されます。 CSS3 Media Queriesを代わりに使用することをお勧めします。私の質問の最後の部分に –

+0

私はcss3メディアのクエリを試してみました(これも私のために働いていない...) – corroded

答えて

0

私はjQM B2のjsファイルでこれを見つけた:

JS:

alert('Orientation: ' + jQuery.event.special.orientationchange.orientation()); 

ここでは、関数そのものです:

// Get the current page orientation. This method is exposed publicly, should it 
// be needed, as jQuery.event.special.orientationchange.orientation() 
$.event.special.orientationchange.orientation = get_orientation = function() { 
    var elem = document.documentElement; 
    return elem && elem.clientWidth/elem.clientHeight < 1.1 ? "portrait" : "landscape"; 
};