Skip to content

Commit 699a183

Browse files
committed
Add ability to set DOM object in programmatic version + Fix examples home page
1 parent 4907a97 commit 699a183

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

example/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ <h3 class="muted">Examples</h3>
2424
<li><a href="hello-world/index.html" title='Basic Usage'>Basic Usage</a></li>
2525
<li><a href="programmatic/index.html" title='Programmatic defining using JSON'>Programmatic defining using JSON</a></li>
2626
<li><a href="multi-page/index.html" title='Multi-Page introduction'>Multi-Page introduction</a></li>
27+
<li><a href="RTL/index.html" title='Multi-Page introduction'>RTL version</a></li>
2728
</ul>
2829
</div>
2930
</body>

example/programmatic/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ <h4>Section Six</h4>
7575
intro.setOptions({
7676
steps: [
7777
{
78-
element: '#step1',
78+
element: document.querySelector('#step1'),
7979
intro: "This is a tooltip."
8080
},
8181
{
82-
element: '#step2',
82+
element: document.querySelectorAll('#step2')[0],
8383
intro: "Ok, wasn't that fun?",
8484
position: 'right'
8585
},

intro.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Intro.js v0.4.0
2+
* Intro.js v0.5.0
33
* https://github.com/usablica/intro.js
44
* MIT licensed
55
*
@@ -19,7 +19,7 @@
1919
}
2020
} (this, function (exports) {
2121
//Default config/variables
22-
var VERSION = '0.4.0';
22+
var VERSION = '0.5.0';
2323

2424
/**
2525
* IntroJs main class
@@ -61,8 +61,11 @@
6161
var currentItem = this._options.steps[i];
6262
//set the step
6363
currentItem.step = i + 1;
64-
//grab the element with given selector from the page
65-
currentItem.element = document.querySelector(currentItem.element);
64+
//use querySelector function only when developer used CSS selector
65+
if (typeof(currentItem.element) === 'string') {
66+
//grab the element with given selector from the page
67+
currentItem.element = document.querySelector(currentItem.element);
68+
}
6669
introItems.push(currentItem);
6770
}
6871

0 commit comments

Comments
 (0)