diff --git a/demo/demo.html b/demo/demo.html index ad34f98..2913383 100644 --- a/demo/demo.html +++ b/demo/demo.html @@ -101,7 +101,7 @@

Make Every Click Count

    -
  1. +
  2. Stop #1

    You can control all the details for you tour stop. Any valid HTML will work inside of Joyride.

  3. @@ -136,15 +136,26 @@

    Stop #5

    $(window).load(function() { $('#joyRideTipContent').joyride({ autoStart : true, + preStepCallback : function () { + alert('all pre step callback'); + }, postStepCallback : function (index, tip) { - if (index == 2) { - $(this).joyride('set_li', false, 1); - } - }, - modal:true, - expose: true + if (index == 2) { + $(this).joyride('set_li', false, 1); + } + alert('all post step callback'); + }, + modal:true, + expose: true }); }); + + function myprealert() { + alert('pre callback test'); + } + function mypostalert() { + alert('post callback test'); + } diff --git a/jquery.joyride-2.1.js b/jquery.joyride-2.1.js index 3e083eb..b3f5216 100755 --- a/jquery.joyride-2.1.js +++ b/jquery.joyride-2.1.js @@ -274,6 +274,13 @@ settings.tipSettings = $.extend({}, settings, opts); settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation]; + // pre callback function of this step + if (typeof settings.tipSettings.preStepCallback === "string") + { + var fn = eval(settings.tipSettings.preStepCallback); + fn.apply(); + } + if(settings.modal && settings.expose){ methods.expose(); } @@ -376,6 +383,12 @@ $('.joyride-modal-bg').hide(); } settings.$current_tip.hide(); + // post callback function of this step + if (typeof settings.tipSettings.postStepCallback === "string") + { + var fn = eval(settings.tipSettings.postStepCallback); + fn.apply(); + } settings.postStepCallback(settings.$li.index(), settings.$current_tip); },