简体   繁体   English

使用iScroll.js时在iOS上启用捏合缩放

[英]Enabling pinch zoom on iOS when using iScroll.js

I'm building a one page scrollable web application using iScroll.js and I can't get its built in zoom feature to work no matter what I do. 我正在使用iScroll.js构建一个页面可滚动的Web应用程序,无论我做什么,我都无法使其内置的缩放功能正常工作。 I'm including the iscroll-zoom.js file yet still haven't had any success. 我包含了iscroll-zoom.js文件,但仍然没有成功。

I've got this in the head of my file: 我在文件的开头有这个:

<script src="js/iscroll.js"></script>
<script src="js/iscroll-zoom.js"></script>
<script src="js/iscroll-probe.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

And this script: 这个脚本:

function loaded () {
myScroll = new IScroll('#wrapper', { 
    mouseWheel: true,
    zoom: true,
    bounce: false 
});

According to the iScroll Documentation this should work, but it doesn't. 根据iScroll文档,这应该可以,但是不能。 If it helps, I need to get this running on an iPad. 如果有帮助,我需要在iPad上运行它。

function createZoomForID (id) {
    $timeout(function(){
        var wrapper = document.getElementById(id);
        var myScroll = new IScrollZ(wrapper, {
            zoom: true,
            zoomMin: 1,
            zoomMax: 4,
            scrollX: true,
            scrollY: true,
            mouseWheel: true,
            freeScroll: true,
            wheelAction: 'zoom',
        });
        $scope[id] = myScroll;
    }, 125);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM