From 424206531cb2f22e335683874f33f78b1fd23fc2 Mon Sep 17 00:00:00 2001 From: IGreatlyDislikeJavascript <45369719+IGreatlyDislikeJavascript@users.noreply.github.com> Date: Tue, 27 Nov 2018 13:28:22 +0000 Subject: [PATCH] Allow step.element to use function 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) --- build/js/bootstrap-tour.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/js/bootstrap-tour.js b/build/js/bootstrap-tour.js index 3dfd1270..7be53ed7 100644 --- a/build/js/bootstrap-tour.js +++ b/build/js/bootstrap-tour.js @@ -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: '',