EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

nextClickSelector Missing in Documentation #149

Closed thenninger closed 8 years ago

thenninger commented 8 years ago

This might be a requested feature, but it is actually coded and not in the documentation. If you would like to set a selector of a control to advance the trip instead of using the next button, set "nextClickSelector" property, and it will hide the Next button, forcing a click on the selector

EragonJ commented 8 years ago

Thanks @Tobysauce77 !! I didn't notice that XDDDD I'll add it back to documentation, thanks.

thenninger commented 8 years ago

I have another issue with nextClickSelector that I could only fix by modifying trip.js code.

In setTripBlock where it sets up the "one" event for the nextClickSelector I added a line because something is making the "one" event trigger twice, so I added "e.stopImmediatePropagation();" to prevent it from triggering again. It makes no sense because it's using jquery's "one," so it should be triggering just once.

// if we have a nextClickSelector use that as the trigger for // the next button if (o.nextClickSelector) { $(o.nextClickSelector).one('click.Trip', function (e) { e.stopImmediatePropagation(); e.preventDefault(); // Force IE/FF to lose focus $(this).blur(); that.next(); }); }

thenninger commented 8 years ago

Also, we are trying to stop the whole trip in our onTripEnd function, and stop resets the index, but tripEnd is called before increaseIndex, so it will set the index to 1 after resetting the index and act like it's on that trip instead of stopping the whole trip. Which events can we safely stop the whole trip?

EragonJ commented 8 years ago

In setTripBlock where it sets up the "one" event for the nextClickSelector I added a line because something is making the "one" event trigger twice, so I added "e.stopImmediatePropagation();" to prevent it from triggering again. It makes no sense because it's using jquery's "one," so it should be triggering just once.

This sounds horrible xDD ...

BTW, because this issue is mainly for docs, I'll move related comments to a new issue and let's discuss there.