[英]How i can use pinch zoom in /out using jquery mobile?
我正在使用Phonegap,我想在使用jquery mobile時使用放大/縮小選項。 我已經嘗試過jgesture和Hammer插件來縮放它。 我在這段代碼中錯了嗎?
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.1.min.css" />
<title>Hello World</title>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script>
$(document).bind("mobileinit", function(){
$.mobile.metaViewportContent = "width=device-width, minimum-scale=1, maximum-scale=2";
});
</script>
<script type="text/javascript" src="js/jquery.mobile-1.4.1.min.js"></script>
</head>
<body>
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
使用Hammer.js捏,捏,捏
這是他們在github上的API的事件文檔:
https://github.com/EightMedia/hammer.js/wiki/Getting-Started
另外,您實際上已經使其無法由用戶擴展...:
initial-scale=1, maximum-scale=1, minimum-scale=1,
這行:
<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=1,
minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"/>
然后使用jquery再次設置它:
$.mobile.metaViewportContent = "width=device-width, minimum-scale=1, maximum-scale=2";
不好,請在這里閱讀: https : //developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.