2

I'm using foundation 4.3.1. This is my code:

$(document).foundation('joyride', {
    postRideCallback: function () {
        alert('test')
    }
});
$(document).foundation('joyride','start');

I can't seem to get it to alert('test') It goes through the ride, but then nothing. Not sure what I'm doing wrong here. The docs aren't clear at all on how or where to put the config options, they only provide a list of what they are.

Why won't the postRideCallback trigger?

phazei
  • 5,323
  • 5
  • 42
  • 46

4 Answers4

1

Okay, so I had to bang my head against the wall quite some time with this but finally got the syntax right. Here goes:

$(document).foundation('joyride', 'start', {
    postStepCallback : function (){
        alert('test');
    }
});
Dziad Borowy
  • 12,368
  • 4
  • 41
  • 53
1

Had a hard time with this myself. In foundation 5, solution is below. Referenced from: https://github.com/zurb/foundation/issues/4468

$(document).foundation({
  joyride: {
    post_ride_callback : function () {
      alert('yay');
    }
  }
 }).foundation('joyride', 'start');
Ryan Francis
  • 635
  • 6
  • 7
0

You need to explicitly either blankety declare foundation on the whole document first or call joyride on the document first then call start + your config... not sure why it's set up this way as it's very confusing but here it is:

var config = {
    nubPosition : 'auto',
    postRideCallback : function() {
      alert('done');
    }

$(document).foundation('joyride').foundation('joyride','start',config);

please vote this up if it works.

btm1
  • 3,866
  • 2
  • 23
  • 26
0

I have been looking for the same response for the whole day. I am also using foundation 4.3. Here we go:

$(function(){ 
    $(document).foundation()
        .foundation('joyride', {
            postRideCallback:function() { alert('test');}
        });
}).foundation('joyride', 'start');
RaySaraiva
  • 383
  • 2
  • 5