简体   繁体   中英

Don't work ion-scroll zoming

I am making simple image view have zoom/scroll(xy). but i can't got correct result by using ion-scroll. i am sorry, I am new on ionic. Here is my .js code part and class.

JS

<ion-content class="bg-color detail-cont">

    <ion-scroll class="filter-image" zooming="true" direction="xy" min-zoom="1" locked="false" has-bouncing="true">
        <div class="my-image" style="background: url('{{ getCurPhotoURI() }}')"></div>
    </ion-scroll>

</ion-content>

CSS

.filter-image {
    height:100% !important;
    width: 100% !important;
    background-color: black;
}
.my-image{
    width: 100% !important;
    height: 100% !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center, center !important;
}

What's wrong? Thank you for advance. Regards.

I assume that the zooming is just not working? This is because the you haven't set the overflow-scroll property to false . For some reason, when you don't set this to false, the ion-scroll element won't be able to detect zooming.

So your code would look like this:

<ion-content class="bg-color detail-cont">

<ion-scroll class="filter-image" overflow-scroll="false" zooming="true" direction="xy" min-zoom="1" locked="false" has-bouncing="true">
    <div class="my-image" style="background: url('{{ getCurPhotoURI() }}')"></div>
</ion-scroll>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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