From 2b11f41678e9eeb186d3f025891baccdd6f2be99 Mon Sep 17 00:00:00 2001 From: Mateusz Sobczak Date: Mon, 13 Apr 2015 16:12:57 -0700 Subject: [PATCH 1/2] Add 'ongo' hook function executed upon transitions. --- js/bjqs-1.3.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/bjqs-1.3.js b/js/bjqs-1.3.js index f06e7b2..ff9da10 100755 --- a/js/bjqs-1.3.js +++ b/js/bjqs-1.3.js @@ -618,6 +618,11 @@ // only if we're not already doing things if(!state.animating){ + + // execute a hook function + if(typeof(settings.ongo) === "function") { + settings.ongo(); + } // doing things state.animating = true; From ce96f58492e789cc0986255213e18c5a48230992 Mon Sep 17 00:00:00 2001 From: Mateusz Sobczak Date: Tue, 14 Apr 2015 09:51:14 -0700 Subject: [PATCH 2/2] Call a hook function after slider transition is done. --- js/bjqs-1.3.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/js/bjqs-1.3.js b/js/bjqs-1.3.js index ff9da10..02f5de3 100755 --- a/js/bjqs-1.3.js +++ b/js/bjqs-1.3.js @@ -46,8 +46,9 @@ // presentational options usecaptions : true, // enable/disable captions using img title attribute - randomstart : false, // start from a random slide - responsive : false // enable responsive behaviour + randomstart : false, // start from a random slide + responsive : false, // enable responsive behaviour + ongo : undefined // a hook function that will be executed upon transition }; @@ -615,14 +616,8 @@ }; var go = function(direction, position) { - // only if we're not already doing things if(!state.animating){ - - // execute a hook function - if(typeof(settings.ongo) === "function") { - settings.ongo(); - } // doing things state.animating = true; @@ -653,6 +648,10 @@ state.currentslide = state.nextslide; state.currentindex = state.nextindex; + // execute a hook function + if(typeof(settings.ongo) === "function") { + settings.ongo(); + } }); } @@ -707,7 +706,11 @@ } state.animating = false; - + + // execute a hook function + if(typeof(settings.ongo) === "function") { + settings.ongo(); + } }); }