elevatezoom-plus icon indicating copy to clipboard operation
elevatezoom-plus copied to clipboard

preloading/load on demand

Open Telrik opened this issue 7 years ago • 3 comments

Hi I use now original version. have problem i have like 200 thumbnails on page and if ez preloads ALL big images at start it's like take alot of time and traffic. i see in plugin code line
preloading: 1, //by default, load all the images, if 0, then only load images after activated (PLACEHOLDER FOR NEXT VERSION)

but it's never used.. so it's kinda not realized in this plus version of plugin as well ? right now i use this code .. problem is on onZoomedImageLoaded event zoom window is not appearing automatically.

  $('img.ezoom-ondemand').hover(function () {
            var _this = $(this);
            var elevateZoom = _this.data('elevateZoom');
            if (typeof elevateZoom === 'undefined') {
                _this.css('cursor', 'wait');
                _this.elevateZoom({
                    tint: true, scrollZoom: true, tintColour: '#337ab7', borderSize: 1, tintOpacity: 0.5, onZoomedImageLoaded: function () {
                        _this.css('cursor', 'pointer');
                    }
                });
            } else {
                //console.log('already');
                //elevateZoom.changeState('enable');
            }
        }
    );

Telrik avatar Aug 30 '17 05:08 Telrik

Ok, tricky question.

Maybe you can trigger manually the event you want?

element.trigger('the-event'); (http://api.jquery.com/trigger/)

What event? you have to decide on your code.

igorlino avatar Nov 27 '17 19:11 igorlino

Similar issue here... would like to load image on demand or at least have the option.

poebrand avatar Mar 27 '18 20:03 poebrand

My solution:

$("selector_for_your_images").each(function() {
  $(this).mouseover( function(event) { 
    $(this).ezPlus(); 
    $(this).unbind(event); 
  })
});

ezPlus is not initialized until the first mouseover (and thus the images are loaded on demand).

daniel-richter avatar Feb 25 '19 21:02 daniel-richter