Skip to content

Commit

Permalink
Fixed zoom image smaller than fly-out
Browse files Browse the repository at this point in the history
Fixed the problem where the fly-out size is smaller than the zoomed
image on either width or height.

Use case:
    My flyout is styled to display on the side of the target image
    at about 500x700 size. Some of the images on the site are larger
    than the preview image, but smaller than this box. It makes sense
    to still show them in fly-out, even if they don't scroll with the
    mouse.
  • Loading branch information
amaltsev committed Apr 5, 2016
1 parent 01f91b6 commit 1c7084c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/easyzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
dw = this.$zoom.width() - w2;
dh = this.$zoom.height() - h2;

// For the case where the zoom image is actually smaller than
// the flyout.
//
if(dw<0) dw=0;
if(dh<0) dh=0;

rw = dw / w1;
rh = dh / h1;

Expand Down

0 comments on commit 1c7084c

Please sign in to comment.