t-t*_*omo 2 html pinch ionic-framework angular 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" />
Run Code Online (Sandbox Code Playgroud)
但事与愿违,在真机上并没有运行。
我也尝试过。
已添加以下内容。
scrollX = "true"
Run Code Online (Sandbox Code Playgroud)
然后,您现在可以在智能手机上捏合/捏合屏幕。但我不知道为什么,也不知道为什么。
另外,如果 的高度足够大以至于需要垂直滚动,我在捏合屏幕后无法水平滚动。
我不知道为什么。我想在屏幕放大后使水平滚动起作用。
如果有人知道怎么做,请告诉我。
您可以使用Pinch zoom for Angular。
该模块提供了通过在触摸屏上使用手势来放大、缩小和定位图像的机会。
查看现场演示。它易于安装。
1 - 安装 npm 包。
npm i ngx-pinch-zoom
Run Code Online (Sandbox Code Playgroud)
2 - 在您的 ts 中导入模块。喜欢home.module.ts:
import { PinchZoomModule } from 'ngx-pinch-zoom';
@NgModule({
imports: [ PinchZoomModule ]
})
Run Code Online (Sandbox Code Playgroud)
3 - 在你的html中
<pinch-zoom>
<img src="path_to_image" />
</pinch-zoom>
Run Code Online (Sandbox Code Playgroud)