zurb / joyride

jQuery feature tour plugin.
http://www.zurb.com/playground/jquery-joyride-feature-tour-plugin
1.42k stars 240 forks source link

postStepCallback: help / example / explain / how-to? #157

Open alisonjo315 opened 10 years ago

alisonjo315 commented 10 years ago

This feels silly, but I think I'd like to add a postStepCallback method/function and I'm having trouble wrapping my head around how to use this Joyride option. Could someone give me an example (or a link to an example -- so far my Google-ing has been unsuccessful)? Or, here's an example scenario: I want to test for or grab the content of the next tip target -- how could I use the postStepCallback Joyride option to do something like that?

Thank you!

alisonjo315 commented 10 years ago

Of course after I finally post an issue, I find something that might help me out :) I'm seeing if the advice/explanation in #91 will be enough for me; I'll report back soon.

alisonjo315 commented 10 years ago

Okay, so I understand the basics now, thanks to https://github.com/zurb/joyride/issues/91#issuecomment-16817542, but I'm still not able to do what I need.

[Note: I have a feeling I might not have so much trouble if I were using v2.1, but I'm using the Drupal module (https://drupal.org/project/joyride), which (like Drupal 8 "Tour") only supports 2.0.3, at least for now.]

Anyway, I want to skip tips/steps with targets that aren't visible -- I was able to try this out by editing jquery.joyride.js and adding settings.$target.height() < 1 as a condition to the "skip non-existent targets" part of the "show" method (currently this conditional is else if (settings.$li && settings.$target.length < 1)), but I don't want to just hack the library -- which brings me to my goal of using the postStepCallback option.

How can I (if possible) get at the TARGET of a tip from a postStepCallback method/function??-- just of the current_tip for now, I'll worry about getting the target of the next tip, well, next :) (I don't think that part will be difficult, though.)

Thank you!