html - 如何使用 Ionic 实现捏合/捏合?

标签 html angular ionic-framework pinch ion-content

我使用 Ionic4 和 Angular8。

我想在智能手机上捏合/捏合屏幕。

我试过的 以下说明已添加到 index.html。

<meta name = "viewport" content = "viewport-fit = cover, width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 4.0, user-scalable = yes" />

但事与愿违,在真机上并没有运行。

我也试过了。

以下已添加到 .

scrollX = "true"

然后您现在可以在智能手机的屏幕上捏合/捏合。 但我不知道为什么或为什么。

另外,如果 的高度足够大,需要垂直滚动 捏合屏幕后无法水平滚动。

我不知道为什么。 我想在屏幕放大后进行水平滚动。

如果有人知道怎么做,请告诉我。

最佳答案

您可以使用 Angular 的双指缩放

The module provides opportunities for image zooming in, zooming out and positioning with use of gestures on a touch screen.

Check out live demo .它易于安装。

1 - 安装 npm 包。

npm i ngx-pinch-zoom

2 - 在你的 ts 中导入模块。像 home.module.ts:

import { PinchZoomModule } from 'ngx-pinch-zoom';

@NgModule({
    imports: [ PinchZoomModule ]
})

3 - 在你的 html 中

<pinch-zoom>
    <img src="path_to_image" /> 
</pinch-zoom>

关于html - 如何使用 Ionic 实现捏合/捏合?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60008429/

相关文章:

html - 过渡在页面加载时无法正确显示

javascript - 如何使用传单markerclusterGroup?

angular - 如何在 ng build --prod 之前运行 ng test 并在 ng test 失败时使 jenkins 作业失败?

ionic-framework - 架构验证失败,出现以下错误

javascript - 如何在浏览器中加载指向文件夹的静态html

javascript - AJAX 返回按钮

html - 响应式 html 在我的 iphone 4s 上显示平板电脑 css 设计而不是手机?

javascript - Cordova 白名单插件手动检测阻止的导航(事件)

不同环境下的Cordova插件管理

html - 将本地 css 文件加载到 webview 中