how to configure foundation joyride plugin callbacks

不想你离开。 提交于 2019-12-24 01:44:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!