Solved. In dev mode, create function at page onViewportEnter, add this line into the function:
$w(‘#image5’).fitMode = “fixedWidth”; //use your image container name
Solved. In dev mode, create function at page onViewportEnter, add this line into the function:
$w(‘#image5’).fitMode = “fixedWidth”; //use your image container name
Wix have the solution to this in the Image API by using the fitMode function.
https://www.wix.com/corvid/reference/$w.Image.html#fitMode
fitMode
Sets or gets how an image is placed inside an image element.
Description
Setting the fitMode property sets what happens when an image element contains an image with dimensions that do not match the dimensions of the element as set in the Editor.
The value can be set to one of “fill”, “fit”, or “fixedWidth”.
Examples
Get the image fit mode
let mode = $w("#myImage").fitMode; // "fixedWidth"
$w("#myImage").fitMode = "fixedWidth";