问题
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?
回答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');
}
});
回答2:
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');
回答3:
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.
回答4:
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');
来源:https://stackoverflow.com/questions/18754402/how-to-configure-foundation-joyride-plugin-callbacks