Skip to content

Commit

Permalink
Allow step.element to use function
Browse files Browse the repository at this point in the history
Step "element" can now use a function to dynamically select the DOM element for the step. Usage:

element: function() { return $(document.body).find(".my-dynamic-element"); },
title: "Dynamic!",
content: "This element was found by jquery",

Change to Tour.prototype.getStep = function (i)
  • Loading branch information
IGreatlyDislikeJavascript authored Nov 27, 2018
1 parent 953551f commit 4242065
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ var bind = function (fn, me) {

Tour.prototype.getStep = function (i) {
if (this._options.steps[i] != null) {

if(typeof(this._options.steps[i].element) == "function")
this._options.steps[i].element = this._options.steps[i].element();

return $.extend({
id: "step-" + i,
path: '',
Expand Down

0 comments on commit 4242065

Please sign in to comment.