EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.

Home Page:https://eragonj.github.io/Trip.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nextClickSelector Missing in Documentation

thenninger opened this issue · comments

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

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

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();
});
}

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?

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.