Skip to content

Commit c138bdd

Browse files
committed
Fix some coding style problem, left and top position overlap with step number + rollback readme
1 parent 0038b11 commit c138bdd

File tree

2 files changed

+6
-4
lines changed

2 files changed

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

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

intro.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,16 @@
157157
}
158158
}
159159

160-
function _placeTooltip(targetElement, tooltipLayer, arrowLayer){
160+
function _placeTooltip(targetElement, tooltipLayer, arrowLayer) {
161161
var tooltipLayerPosition = _getOffset(tooltipLayer);
162+
//reset the old style
162163
tooltipLayer.style.top = null;
163164
tooltipLayer.style.right = null;
164165
tooltipLayer.style.bottom = null;
165166
tooltipLayer.style.left = null;
166167
switch(targetElement.getAttribute('data-position')){
167168
case 'top':
169+
tooltipLayer.style.left = "15px";
168170
tooltipLayer.style.top = "-" + (tooltipLayerPosition.height + 10) + "px";
169171
arrowLayer.className = 'introjs-arrow bottom';
170172
break;
@@ -174,6 +176,7 @@
174176
arrowLayer.className = 'introjs-arrow left';
175177
break;
176178
case 'left':
179+
tooltipLayer.style.top = "15px";
177180
tooltipLayer.style.left = "-" + (tooltipLayerPosition.width + 10) + "px";
178181
arrowLayer.className = 'introjs-arrow right';
179182
break;
@@ -198,7 +201,6 @@
198201
oldHelperLayer = document.querySelector(".introjs-helperLayer"),
199202
elementPosition = _getOffset(targetElement);
200203

201-
//targetElement.scrollIntoView();
202204
if(oldHelperLayer != null) {
203205
var oldHelperNumberLayer = oldHelperLayer.querySelector(".introjs-helperNumberLayer"),
204206
oldtooltipLayer = oldHelperLayer.querySelector(".introjs-tooltiptext"),

0 commit comments

Comments
 (0)