sparanoid/lightense-images

Allow upscaling

vollstock opened this issue · 1 comments

With a small change, you could let the user configure whether or not he wants to allow upscaling images or not

in line 108 add a default (false to keep normal behaviour as is):

  // default options
  var defaults = {
    time: 300,
    padding: 40,
    offset: 40,
    keyboard: true,
    cubicBezier: 'cubic-bezier(.2, 0, .1, 1)',
    background: 'rgba(255, 255, 255, .98)',
    zIndex: 2147483647,
    allowUpscaling: false
  };

And in line 260 change the if statement to this:

if (naturalWidth < viewportWidthOffset && naturalHeight < viewportHeightOffset && !config.allowUpscaling) {
//...

Thanks a lot :-)

I have included this because I am loading high-res images after zooming into the low-res thumbnails.
With the old behaviour, the plugin would restrict zoom to the size of the small thumbnail images.