[英]Ionic pinch to zoom in image
我只想在離子視圖中放置圖像,使其全寬,並在發生捏合事件時允許zoomIn / zoomOut。 看起來很簡單,但我可以做到! 我是Ionic1的新手。 有人能幫我嗎?
這是我嘗試過但無法實現的目標:
<ion-view view-title="MAP"> <ion-content> <ion-scroll zooming="true" direction="xy" delegate-handle="zoom-pane" class="zoom-pane" scrollbar-x="false" scrollbar-y="false"> <img ng-src="img/map.png"> </ion-scroll> </ion-content> </ion-view>
只是您必須在ion-scroll中添加overflow-scroll =“ false”屬性
的HTML
<ion-scroll id="mapImage"
zooming="true"
direction="xy"
delegate-handle="zoom-pane"
class="zoom-pane"
min-zoom="1"
max-zoom="15"
overflow-scroll="false">
<img ng-src="img/map.png">
</ion-scroll>
的CSS
.zoom-pane {
width: 100% !important;
height: 100% !important;
}
.zoom-pane .scroll {
min-height: 100% !important;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-moz-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: center;
-moz-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.zoom-pane img {
width: 100% !important;
vertical-align: top !important;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.