JQuery Mobile pinch&缩放iOS

时间:2012-08-22 13:58:51

标签: javascript jquery jquery-mobile

我正在使用JQuery Mobile和Phonegap构建iPhone应用程序。如何启用捏合和缩放手势?

我试过这个:

$(document).bind('mobileinit', function(){
        alert('mobileinit2');
        $.mobile.metaViewportContent = 'width=device-width, minimum-scale=1, maximum-scale=2, user-scalable=yes';

        $.extend($.mobile.zoom, {locked:false,enabled:true});
        alert('/mobileinit');
});

但它对我不起作用。

谢谢

2 个答案:

答案 0 :(得分:1)

你想缩放整个应用程序或只是内部的一个div?

如果是第二个,请尝试使用iScroll

iscroll

答案 1 :(得分:0)

尝试这样的事情:

var con=document.getElementById('containerId');

con.addEventListener('gesturechange',function(e){
    if(e.scale>1)
    {
        //zoom in 
    }
    else if(e.scale<1)
    {
        //zoom out 
    }
});