Skip to content

Commit f180dc5

Browse files
author
Ben M
committed
Added read me instructions. Fixed default position.
Added instructions on how to use the 'data-position' attribute to the read me. Fixed the default position of the tooltip where it wasn't placing the tooltip at the bottom position unless specified as such; it now defaults to the bottom if no data-position is set. Ran the file through javascriptlint and fixed a couple small things.
1 parent 0278cd1 commit f180dc5

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Intro.js can be added to your site in three simple steps:
88

99
**1)** Include `intro.js` and `introjs.css` (or the minified version for production) in your page.
1010

11-
**2)** Add `data-intro` and `data-step` to your HTML elements.
11+
**2)** Add `data-intro` and `data-step` to your HTML elements. You can optionally set the tooltip's position by adding `data-position`. The default position is 'bottom'.
1212
For example:
1313
```html
14-
<a href='http://google.com/' data-intro='Hello step one!' data-step='1'></a>
14+
<a href='http://google.com/' data-intro='Hello step one!' data-step='1' data-position='right'></a>
1515
````
1616

1717
**3)** Call this JavaScript function:

intro.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
//right arrow
7878
_nextStep.call(self);
7979
}
80-
};
81-
}
80+
}
81+
};
8282
}
8383
return false;
8484
}
@@ -111,8 +111,9 @@
111111
* @method _nextStep
112112
*/
113113
function _previousStep() {
114-
if(this._currentStep == 0)
114+
if(this._currentStep == 0){
115115
return;
116+
}
116117

117118
_showElement.call(this, this._introItems[--this._currentStep].element);
118119
}
@@ -158,14 +159,15 @@
158159
tooltipLayer.style.right = "-" + (tooltipLayerPosition.width + 10) + "px";
159160
arrowLayer.className = 'introjs-arrow left';
160161
break;
161-
case 'bottom':
162-
tooltipLayer.style.bottom = "-" + (tooltipLayerPosition.height + 10) + "px";
163-
arrowLayer.className = 'introjs-arrow top';
164-
break;
165162
case 'left':
166163
tooltipLayer.style.left = "-" + (tooltipLayerPosition.width + 10) + "px";
167164
arrowLayer.className = 'introjs-arrow right';
168165
break;
166+
case 'bottom':
167+
default:
168+
tooltipLayer.style.bottom = "-" + (tooltipLayerPosition.height + 10) + "px";
169+
arrowLayer.className = 'introjs-arrow top';
170+
break;
169171
}
170172
}
171173

0 commit comments

Comments
 (0)