From 9491fe4c2ae67efa3c829d341b8a42e40bf716c1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 9 May 2013 09:39:25 +0300 Subject: [PATCH] added reset function call reset function before populating timeline with new data (before calling my_timeline_obj.init(my_timeline_config);) example make global: var timeline_config, storyjs_embedjs; //in your init function : if (storyjs_embedjs === undefined) { storyjs_embedjs = new VMM.Timeline('my-timeline', '100%', '100%'); storyjs_embedjs.init(timeline_config); } else { storyjs_embedjs.reset(); storyjs_embedjs.init(timeline_config); } --- source/js/VMM.Timeline.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/js/VMM.Timeline.js b/source/js/VMM.Timeline.js index 7d2fb8c..6566323 100755 --- a/source/js/VMM.Timeline.js +++ b/source/js/VMM.Timeline.js @@ -449,7 +449,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { slider.setSlide(0); timenav.setMarker(0, config.ease,config.duration); }; - + //call this function before + this.reset = function() { + config.current_slide = 0; + slider.setSlide(0); + timenav.setMarker(0, config.ease,config.duration); + } /* DATA ================================================== */ function getData(url) { @@ -719,4 +724,4 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { VMM.Timeline.Config = {}; -}; \ No newline at end of file +};