Reputation: 150
I made an image viewer component to pinch-zoom in its mobile app using react ionic. My problem is that when I zoom the image, it will be zoomed just to the image's width. I want the image to be zoomed to the edge of the card padding. here are my codes
<React.Fragment>
<IonCard id="ImgViewCard">
<IonCardContent>
<TransformWrapper>
<TransformComponent>
<IonImg id="ImgViewImage" src={prop.ImgSource}></IonImg>
</TransformComponent>
</TransformWrapper>
</IonCardContent>
</IonCard>
</React.Fragment>;
#ImgViewCard {
height: 400px;
display: flex;
justify-content: center;
align-items: center;
}
#ImgViewImage {
height: 370px;
}
How can I fix this? What is your suggestion?
Upvotes: 2
Views: 120
Reputation: 106
You can wrap the image in a container using the full width of the container.
<div class="container">
<div class="image-card">
<img src="">
</div>
</div>
.image-card
.image-card {
position: absolute;
top: 0;
left: 0;
}
I think this will help.
Upvotes: 1