From: Dimitri Jorge Date: Tue, 16 Sep 2014 17:36:04 +0000 (+0200) Subject: Fix joyride error X-Git-Tag: v5.4.6^2~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5818%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git 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. --- 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