From 3fd440a849d1d41b5d8283acebce9b93d87ca1fb Mon Sep 17 00:00:00 2001 From: Sanjay Bhangar Date: Wed, 14 Mar 2018 23:21:14 +0530 Subject: [PATCH] cleanup timeouts for zooms --- example/example.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/example/example.js b/example/example.js index 6be8a32..f415a02 100644 --- a/example/example.js +++ b/example/example.js @@ -60,7 +60,7 @@ function start(idx) { function stop(idx) { var data = slideData[idx] console.log(current, data) - if (data.zoom_to) { + if (data.zooms) { reset_zoom(data) } else if (data.video && data.video.length) { reset_video(data) @@ -121,8 +121,9 @@ window.addEventListener('blur', function(){ function reset_zoom(data) { + data.zoomTimeouts.forEach(timeout => clearTimeout(timeout)) data.embed.postMessage('options', { - 'area': data.zoom_from + 'area': data.zooms[0] }) } @@ -130,12 +131,13 @@ function start_zoom(data) { // console.log('start zoon', Math.round(1000 * data.duration / 2)) for (var i=1; i