Skip to content

Commit

Permalink
Merge pull request #16 from stepan-twnty/fix/null_request
Browse files Browse the repository at this point in the history
fix: resolve problem with null request on the first load
  • Loading branch information
Mario-Duarte authored May 16, 2024
2 parents 84c7f66 + 400ed43 commit e247924
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/react-image-zooom.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function ImageZoom({
id={id}
className={[figureClass, figureZoomed, className].join(" ")}
style={{
backgroundImage: `url( ${zoomed === '0' ? imgData : ''} )`,
backgroundImage: `url( ${zoomed === '0' && imgData ? imgData : ''} )`,
backgroundSize: zoom + "%",
backgroundPosition: position,
}}
Expand All @@ -202,14 +202,14 @@ function ImageZoom({
onTouchMove={handleMove}
onTouchEnd={handleLeave}
>
<Img
{imgData && <Img
id="imageZoom"
src={imgData}
alt={alt}
style={{ opacity: zoomed }}
width={width}
height={height}
/>
/>}
</Figure>
);
}
Expand Down

0 comments on commit e247924

Please sign in to comment.