Created
May 21, 2012 20:55
-
-
Save hanleybrand/2764629 to your computer and use it in GitHub Desktop.
ZURB Joyride - reset 'count' when tour is finished
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* problem: when ZURB's Joyride tour ends, if the user causes it to run again, the | |
'count' seems to be messed up | |
solution: the plugin creates divs with ids in the pattern: 'joyRidePopup' + index | |
and then iterates through them - running the iteration again recreates the divs & | |
re-runs and gets confused. So you use postRideCallback (one of the options, see | |
http://www.zurb.com/playground/jquery-joyride-feature-tour-plugin - step 5 for more info) | |
to remove those divs when the ride ends | |
this GIST shows how to bind joyride to a 'HELP' button that will trigger the tour when clicked. | |
*/ | |
var helpMe = function helpInstance(){ | |
$('div[id^="joyRidePopup"]').remove(); /* in case button is clicked | |
while tour is running */ | |
$(document).joyride( | |
{ | |
// add any other option listed at the playground | |
// http://www.zurb.com/playground/jquery-joyride-feature-tour-plugin | |
'postRideCallback': function(){ | |
$('div[id^="joyRidePopup"]').remove(); | |
} // a method to call once the tour closes | |
}); | |
}; //end helpInstance() | |
$("#help").on('click', helpMe); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Help,
When you enter the website, the tour is successful, but when I run it with the button does not work.
What am I doing wrong?
$(window).load(function() {
});
$(document).ready(function() {
}