gpt4 book ai didi

mobile - 如何在图像上进行捏合/缩放

转载 作者:行者123 更新时间:2023-12-01 11:04:07 26 4
gpt4 key购买 nike

我仍在学习 jQuery mobile 的技巧,并且在 data-role="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>

非常感谢你的帮助。非常感激。

-鲍勃

最佳答案

控制这些设置的是视口(viewport)元数据属性。

Follow this查看如何在 JQM iOS 上启用捏合和缩放(您使用的是 PhoneGap 并不重要)。

希望这可以帮助。

When jQuery Mobile renders a page, it adds the following meta tag to the head of the document.


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

It is the minimum-scale=1, maximum-scale=1 part of the tag which disables the pinch zoom. What we need to do is modify the $.mobile.metaViewportContent variable. We can do this using the following code.


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

If we want to restrict the amount of zooming, we can use the following:


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

关于mobile - 如何在图像上进行捏合/缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7815956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com