Sha256: 4ba0e68515328c08183c4db3822e35048498a9fe91dd6aab9dd7a901a9313190

Contents?: true

Size: 1.41 KB

Versions: 25

Compression:

Stored size: 1.41 KB

Contents

function imgPreview() {
  xOffset = 20; // separacion de la imagen con respecto al puntero en X
  yOffset = 20; // separacion de la imagen con respecto al puntero en Y
  imgMargin = 50; // separacion de la imagen con respecto al borde de la pantalla
  $('.show-row img, .list-row img').hover(function (e) {
    $('body').append(`<img src='${this.src}' alt='No image source' class='img-show' >`);
    xImgOffset = $(window).width() - ($('.img-show').width() + imgMargin);
    yImgOffset = $(window).height() - ($('.img-show').height() + imgMargin); // breakpoint para que la imagen siempre esté visible en la pantalla
    $('.img-show')
      .css({
        'left': ((e.pageX < xImgOffset ? e.pageX : (e.pageY < yImgOffset ? xImgOffset : (e.pageX - ($('.img-show').width() + imgMargin)))) + xOffset) + 'px',
        'top': ((e.pageY < yImgOffset ? e.pageY : (yImgOffset)) + yOffset) + 'px'
      })
  }, function () {
    $('.img-show').remove();
  });
  $('.show-row img, .list-row img').mousemove(function (e) {
    $('.img-show')
      .css({
        'left': ((e.pageX < xImgOffset ? e.pageX : (e.pageY < yImgOffset ? xImgOffset : (e.pageX - ($('.img-show').width() + imgMargin)))) + xOffset) + 'px',
        'top': ((e.pageY < (yImgOffset) ? e.pageY : (yImgOffset)) + yOffset) + 'px'
      })
  });
}

$(document).on('turbolinks:render', function () {
  imgPreview()
})

$(document).on('turbolinks:load', function () {
  imgPreview()
})

Version data entries

25 entries across 24 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.21 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.20 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.19 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.18 testing-with-2.1.18/app/assets/javascripts/admin/img_preview.js
keppler-2.1.18 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.17 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.16 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.15 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.14 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.13 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.12 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.11 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.10 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.9 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.8 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.7 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.6 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.5 installer/core/app/assets/javascripts/admin/img_preview.js
keppler-2.1.4 installer/core/app/assets/javascripts/admin/img_preview.js