elevatezoom-plus
elevatezoom-plus copied to clipboard
preloading/load on demand
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');
}
}
);
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.
Similar issue here... would like to load image on demand or at least have the option.
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).