Open RS71 opened 11 years ago
This would be a great feature.
We achieved the deferred loading of the zoom image by doing the following (for mouseover trigger setting , Zoom 1.7.21 ):
Change the img.onload to a named function:
img.onload = function () {
to
function zoomImgLoaded() {
replace
img.src = settings.url
with
$source.one('mouseenter touchstart', (evt) => {
img.onload = zoomImgLoaded.bind(evt);
img.src = settings.url;
);
and lastly add
start(this)
to the end of zoomImgLoaded
We need to maintain the order of events (image load event, mouseenter, mousemoves), and that means holding onto the mouseenter event so we can pass it to the start function after we run the init function, since .on('mouseenter.zoom', start)
will be skipped.
Would be nice to have a setting to postpone the loading of the image until the zoom trigger is activated.