From 7ad937937a2a7725759bec7832b1b4247f153947 Mon Sep 17 00:00:00 2001 From: Dimitri Jorge Date: Tue, 16 Sep 2014 19:36:04 +0200 Subject: [PATCH] Fix joyride error When the joyride is included on the page but hasn't been started yet, the keystrokes events are still catched and we end up with a JS error on `go_next` or `go_prev` functions. This fix checks that the joyride is on screen before calling theses callbacks. --- js/foundation/foundation.joyride.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/foundation/foundation.joyride.js b/js/foundation/foundation.joyride.js index c0731b051..9bbe3583c 100644 --- a/js/foundation/foundation.joyride.js +++ b/js/foundation/foundation.joyride.js @@ -111,8 +111,10 @@ this.end(this.settings.abort_on_close); }.bind(this)) - .on("keyup.joyride", function(e) { - if (!this.settings.keyboard) return; + .on("keyup.fndtn.joyride", function(e) { + // Don't do anything if keystrokes are disabled + // or if the joyride is not being shown + if (!this.settings.keyboard || !this.settings.riding) return; switch (e.which) { case 39: // right arrow -- 2.47.2