]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix joyride error 5818/head
authorDimitri Jorge <jorge.dimitri@gmail.com>
Tue, 16 Sep 2014 17:36:04 +0000 (19:36 +0200)
committerDimitri Jorge <jorge.dimitri@gmail.com>
Tue, 16 Sep 2014 17:36:04 +0000 (19:36 +0200)
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

index c0731b051cce778c238fdb9193a6a5683007bbff..9bbe3583c1562972063470b4fafa4f0a9aaa6780 100644 (file)
           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