質問

私はまだJquery Mobileのトリックを学んでおり、データロール= "Page"の画像/画像のズームインとズームアウトに問題を抱えています。 JQuery Mobileを使用してiPhoneの画像でピンチ/ズームを動作させる方法はありますか? iOSシミュレーターで動作させることはできません。これが私のコードです。

<!DOCTYPE html> 
<html>
<head>
<meta charset="UTF-8">
<title>jQuery Mobile Web App</title>

<meta content="width=device-width, initial-scale=1, maximum-scale=2" name="viewport">

<link href="jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-1.5.min.js" type="text/javascript"></script>
<script src="jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
<!-- This reference to phonegap.js will allow for code hints as long as the current site     has been configured as a mobile application. 
To configure the site as a mobile application, go to Site -> Mobile Applications ->     Configure Application Framework... -->
<script src="/phonegap.js" type="text/javascript"></script>
</head> 
<body> 

    <div data-role="page" id="page">
    <div data-role="header">
    <h1>Page One</h1>
    </div>
    <div data-role="content" style="padding:0;">    
           <img src="coffee.gif" width="320" height="480" alt="coffee">
        </div>
    <div data-role="footer">
    <h4>Page Footer</h4>
   </div>
    </div>
</body>
</html>

どうもありがとうございました。とても有難い。

-ボブ

役に立ちましたか?

解決

これらの設定を制御するのは、ビューポートメタデータプロパティです。

これに従ってください JQM iOSでピンチとズームを有効にする方法を確認するには(PhoneGapを使用していることは本当に問題ではありません)。

お役に立てれば。

jQueryモバイルがページをレンダリングすると、次のメタタグをドキュメントのヘッドに追加します。

<meta content="width=device-width, minimum-scale=1, maximum-scale=1" name="viewport"> 

ピンチズームを無効にするのは、最小スケール= 1、最大スケール=タグの1部です。私たちがする必要があるのは、$ .MOBILE.METAVIEWPORTCONTENT変数を変更することです。これは、次のコードを使用して行うことができます。

$(document).bind('mobileinit', function(){ 
    $.mobile.metaViewportContent = 'width=device-width'; 
}); 

ズームの量を制限したい場合は、以下を使用できます。

$(document).bind('mobileinit', function(){ 
    $.mobile.metaViewportContent = 'width=device-width, minimum-scale=1, maximum-scale=2'; 
});

他のヒント

これでメタタグの「ビューポート」を編集する

<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=2, minimum-scale=0.5, width=device-width, height=device-height, target-densitydpi=device-dpi" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top