From c3a782f8213c98b4c2217e3238d645a4933532d8 Mon Sep 17 00:00:00 2001 From: Opher Vishnia Date: Tue, 23 Dec 2014 15:57:35 +0200 Subject: [PATCH 1/2] Added afterFling listener This enables users to be able to execute logic after the smoothScroll animation has ended --- src/skrollr.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/skrollr.js b/src/skrollr.js index 89b98e9a..791212be 100644 --- a/src/skrollr.js +++ b/src/skrollr.js @@ -253,7 +253,10 @@ render: options.render, //Function to be called whenever an element with the `data-emit-events` attribute passes a keyframe. - keyframe: options.keyframe + keyframe: options.keyframe, + + //Function to be called after a fling animation has ended + afterfling: options.afterfling }; //forceHeight is true by default @@ -807,7 +810,8 @@ duration = duration * (1 - targetRatio); - _instance.animateTo((targetTop + 0.5) | 0, {easing: 'outCubic', duration: duration}); + var direction = (distanceY)>0?"down":"up"; + _instance.animateTo((targetTop + 0.5) | 0, {easing: 'outCubic', duration: duration, done: _listeners.afterfling(direction)}); break; } }); From 0e3264f0043069c389af06c75bc0a4ea7fa2ce7d Mon Sep 17 00:00:00 2001 From: OpherV Date: Wed, 24 Dec 2014 17:41:38 +0200 Subject: [PATCH 2/2] fixed jshint quote style --- src/skrollr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skrollr.js b/src/skrollr.js index 791212be..3cb9f01b 100644 --- a/src/skrollr.js +++ b/src/skrollr.js @@ -810,7 +810,7 @@ duration = duration * (1 - targetRatio); - var direction = (distanceY)>0?"down":"up"; + var direction = (distanceY)>0?'down':'up'; _instance.animateTo((targetTop + 0.5) | 0, {easing: 'outCubic', duration: duration, done: _listeners.afterfling(direction)}); break; }