Skip to content

Commit d251af5

Browse files
author
MikeCBI
committed
Updated to upstream
2 parents f258315 + a25c722 commit d251af5

File tree

12 files changed

+963
-78
lines changed

12 files changed

+963
-78
lines changed

.spmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BUILD
2+
example
3+
minified

README.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,39 @@ Intro.js can be added to your site in three simple steps:
2121
2222
**2)** Add `data-intro` and `data-step` to your HTML elements.
2323

24-
For example:
24+
For example:
2525

2626
```html
2727
<a href='http://google.com/' data-intro='Hello step one!'></a>
2828
````
2929

3030
See all attributes [here](https://github.com/usablica/intro.js/#attributes).
31-
31+
3232
**3)** Call this JavaScript function:
3333
```javascript
3434
introJs().start();
3535
````
36-
36+
3737
Optionally, pass one parameter to `introJs` function to limit the presentation section.
3838

3939
**For example** `introJs(".introduction-farm").start();` runs the introduction only for elements with `class='introduction-farm'`.
4040

4141
<p align="center"><img src="http://usablica.github.com/intro.js/img/introjs-demo.png"></p>
4242

43+
## Using templates
44+
45+
IntroJS provides awesome templates and we are trying to update and add more templates for next versions. You can browse all templates here: https://github.com/usablica/intro.js/wiki/IntroJs-templates
46+
47+
In order to use templates, all you need to do is appending the template stylesheet to your page, *after* IntroJS CSS file:
48+
49+
```html
50+
<!-- Add IntroJs styles -->
51+
<link href="../../introjs.css" rel="stylesheet">
52+
53+
<!-- Add Nazanin template -->
54+
<link href="../../themes/introjs-nazanin.css" rel="stylesheet">
55+
```
56+
4357
## API
4458

4559
###introJs([targetElm])
@@ -314,7 +328,7 @@ introJs().onafterchange(function(targetElement) {
314328
- `data-intro`: The tooltip text of step
315329
- `data-step`: Optionally define the number (priority) of step
316330
- `data-tooltipClass`: Optionally define a CSS class for tooltip
317-
- `data-position`: Optionally define the position of tooltip, `top`, `left`, `right` or `bottom`. Default is `bottom`
331+
- `data-position`: Optionally define the position of tooltip, `top`, `left`, `right`, `bottom`, `bottom-left-aligned` (same as 'bottom'), 'bottom-middle-aligned' and 'bottom-right-aligned'. Default is `bottom`
318332

319333
###Options:
320334

@@ -332,6 +346,7 @@ introJs().onafterchange(function(targetElement) {
332346
- `showButtons`: Show introduction navigation buttons or not, `true` or `false`
333347
- `showBullets`: Show introduction bullets or not, `true` or `false`
334348
- `scrollToElement`: Auto scroll to highlighted element if it's outside of viewport, `true` or `false`
349+
- `overlayOpacity`: Adjust the overlay opacity, `Number`
335350
336351
See [setOption](https://github.com/usablica/intro.js/#introjssetoptionoption-value) to see an example.
337352
@@ -377,9 +392,15 @@ Want to learn faster and easier? Here we have **Instant IntroJs**, Packt Publish
377392
## Roadmap
378393
- Fix problems with `position: fixed` and other positions
379394
- Provide more examples
395+
- Add more templates
380396

381397
## Release History
382398

399+
* **v0.9.0** - 2014-05-23
400+
- Add IntroJS templates
401+
- Add more tooltip positions (bottom-right, bottom-middle, bottom-left)
402+
- Fix table `tr` element's issue
403+
383404
* **v0.8.0** - 2014-03-25
384405
- Ability to define introductions without focusing on elements
385406
- Fix Internet Explorer 8.0 issue
@@ -458,10 +479,10 @@ Want to learn faster and easier? Here we have **Instant IntroJs**, Packt Publish
458479
- Fix show element for elements with position `absolute` or `relative`
459480
- Add `enter` key for navigating in steps
460481
- Code refactoring
461-
462-
463-
* **v0.1.0** - 2013-03-16
464-
- First commit.
482+
483+
484+
* **v0.1.0** - 2013-03-16
485+
- First commit.
465486
466487
## Author
467488
**Afshin Mehrabani**
@@ -480,15 +501,15 @@ Want to learn faster and easier? Here we have **Instant IntroJs**, Packt Publish
480501
## License
481502
> Copyright (C) 2012 Afshin Mehrabani ([email protected])
482503
483-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
484-
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
485-
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
504+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
505+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
506+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
486507
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
487-
The above copyright notice and this permission notice shall be included in all copies or substantial portions
508+
The above copyright notice and this permission notice shall be included in all copies or substantial portions
488509
of the Software.
489510
490-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
491-
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
492-
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
493-
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
511+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
512+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
513+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
514+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
494515
IN THE SOFTWARE.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intro.js",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "A better way for new feature introduction and step-by-step users guide for your website and project.",
55
"keywords": ["demo", "intro", "introduction"],
66
"homepage": "http://usablica.github.com/intro.js/",

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "intro.js",
33
"repo": "usablica/intro.js",
44
"description": "Better introductions for websites and features with a step-by-step guide for your projects",
5-
"version": "0.8.0",
5+
"version": "0.9.0",
66
"main": "intro.js",
77
"scripts": [
88
"intro.js"

intro.js

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Intro.js v0.8.0
2+
* Intro.js v0.9.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.8.0';
22+
var VERSION = '0.9.0';
2323

2424
/**
2525
* IntroJs main class
@@ -56,6 +56,8 @@
5656
showBullets: true,
5757
/* Scroll to highlighted element? */
5858
scrollToElement: true,
59+
/* Set the overlay opacity */
60+
overlayOpacity: 0.8,
5961
/* Precedence of positions, when auto is enabled */
6062
positionPrecedence: ["bottom", "top", "right", "left"]
6163
};
@@ -297,7 +299,7 @@
297299
*/
298300
function _previousStep() {
299301
this._direction = 'backward';
300-
302+
301303
if (this._currentStep === 0) {
302304
return false;
303305
}
@@ -320,7 +322,7 @@
320322
function _exitIntro(targetElement) {
321323
//remove overlay layer from the page
322324
var overlayLayer = targetElement.querySelector('.introjs-overlay');
323-
325+
324326
//return if intro already completed or skipped
325327
if (overlayLayer == null) {
326328
return;
@@ -371,7 +373,7 @@
371373
} else if (document.detachEvent) { //IE
372374
document.detachEvent('onkeydown', this._onKeyDown);
373375
}
374-
376+
375377
//set the step to zero
376378
this._currentStep = undefined;
377379
}
@@ -386,6 +388,11 @@
386388
* @param {Object} arrowLayer
387389
*/
388390
function _placeTooltip(targetElement, tooltipLayer, arrowLayer, helperNumberLayer) {
391+
var tooltipCssClass = '',
392+
currentStepObj,
393+
tooltipOffset,
394+
targetElementOffset;
395+
389396
//reset the old style
390397
tooltipLayer.style.top = null;
391398
tooltipLayer.style.right = null;
@@ -404,10 +411,8 @@
404411
//prevent error when `this._currentStep` is undefined
405412
if (!this._introItems[this._currentStep]) return;
406413

407-
var tooltipCssClass = '';
408-
409414
//if we have a custom css class for each step
410-
var currentStepObj = this._introItems[this._currentStep];
415+
currentStepObj = this._introItems[this._currentStep];
411416
if (typeof (currentStepObj.tooltipClass) === 'string') {
412417
tooltipCssClass = currentStepObj.tooltipClass;
413418
} else {
@@ -419,7 +424,7 @@
419424
//custom css class for tooltip boxes
420425
var tooltipCssClass = this._options.tooltipClass;
421426

422-
var currentTooltipPosition = this._introItems[this._currentStep].position;
427+
currentTooltipPosition = this._introItems[this._currentStep].position;
423428
if ((currentTooltipPosition == "auto" || this._options.tooltipPosition == "auto")) {
424429
if (currentTooltipPosition != "floating") { // Floating is always valid, no point in calculating
425430
currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition)
@@ -464,8 +469,8 @@
464469
case 'floating':
465470
arrowLayer.style.display = 'none';
466471

467-
//we have to adjust the top and left of layer manually for intro items without element{
468-
var tooltipOffset = _getOffset(tooltipLayer);
472+
//we have to adjust the top and left of layer manually for intro items without element
473+
tooltipOffset = _getOffset(tooltipLayer);
469474

470475
tooltipLayer.style.left = '50%';
471476
tooltipLayer.style.top = '50%';
@@ -478,6 +483,21 @@
478483
}
479484

480485
break;
486+
case 'bottom-right-aligned':
487+
arrowLayer.className = 'introjs-arrow top-right';
488+
tooltipLayer.style.right = '0px';
489+
tooltipLayer.style.bottom = '-' + (_getOffset(tooltipLayer).height + 10) + 'px';
490+
break;
491+
case 'bottom-middle-aligned':
492+
targetElementOffset = _getOffset(targetElement);
493+
tooltipOffset = _getOffset(tooltipLayer);
494+
495+
arrowLayer.className = 'introjs-arrow top-middle';
496+
tooltipLayer.style.left = (targetElementOffset.width / 2 - tooltipOffset.width / 2) + 'px';
497+
tooltipLayer.style.bottom = '-' + (tooltipOffset.height + 10) + 'px';
498+
break;
499+
case 'bottom-left-aligned':
500+
// Bottom-left-aligned is the same as the default bottom
481501
case 'bottom':
482502
// Bottom going to follow the default behavior
483503
default:
@@ -578,10 +598,10 @@
578598
//prevent error when `this._currentStep` in undefined
579599
if (!this._introItems[this._currentStep]) return;
580600

581-
var currentElement = this._introItems[this._currentStep];
582-
var elementPosition = _getOffset(currentElement.element);
601+
var currentElement = this._introItems[this._currentStep],
602+
elementPosition = _getOffset(currentElement.element),
603+
widthHeightPadding = 10;
583604

584-
var widthHeightPadding = 10;
585605
if (currentElement.position == 'floating') {
586606
widthHeightPadding = 0;
587607
}
@@ -670,9 +690,7 @@
670690

671691
//show the tooltip
672692
oldtooltipContainer.style.opacity = 1;
673-
if (oldHelperNumberLayer != null) {
674-
oldHelperNumberLayer.style.opacity = 1;
675-
}
693+
if (oldHelperNumberLayer) oldHelperNumberLayer.style.opacity = 1;
676694
}, 350);
677695

678696
} else {
@@ -834,14 +852,14 @@
834852
while (parentElm != null) {
835853
if (parentElm.tagName.toLowerCase() === 'body') break;
836854

837-
//fix The Stacking Contenxt problem.
855+
//fix The Stacking Contenxt problem.
838856
//More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
839857
var zIndex = _getPropValue(parentElm, 'z-index');
840858
var opacity = parseFloat(_getPropValue(parentElm, 'opacity'));
841859
if (/[0-9]+/.test(zIndex) || opacity < 1) {
842860
parentElm.className += ' introjs-fixParent';
843861
}
844-
862+
845863
parentElm = parentElm.parentNode;
846864
}
847865

@@ -860,7 +878,7 @@
860878
window.scrollBy(0, bottom + 100); // 70px + 30px padding from edge to look nice
861879
}
862880
}
863-
881+
864882
if (typeof (this._introAfterChangeCallback) !== 'undefined') {
865883
this._introAfterChangeCallback.call(this, targetElement.element);
866884
}
@@ -970,9 +988,10 @@
970988
};
971989

972990
setTimeout(function() {
973-
styleText += 'opacity: .8;';
991+
styleText += 'opacity: ' + self._options.overlayOpacity.toString() + ';';
974992
overlayLayer.setAttribute('style', styleText);
975993
}, 10);
994+
976995
return true;
977996
}
978997

introjs.css

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
opacity: 1.0 !important;
2525
}
2626

27-
.introjs-showElement {
27+
.introjs-showElement,
28+
tr.introjs-showElement > td,
29+
tr.introjs-showElement > th {
2830
z-index: 9999999 !important;
2931
}
3032

31-
.introjs-relativePosition {
33+
.introjs-relativePosition,
34+
tr.introjs-showElement > td,
35+
tr.introjs-showElement > th {
3236
position: relative;
3337
}
3438

@@ -78,7 +82,7 @@
7882
line-height: 20px;
7983
border: 3px solid white;
8084
border-radius: 50%;
81-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */
85+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */
8286
filter: progid:DXImageTransform.Microsoft.Shadow(direction=135, strength=2, color=ff0000); /* IE10 text shadows */
8387
box-shadow: 0 2px 5px rgba(0,0,0,.4);
8488
}
@@ -95,6 +99,23 @@
9599
border-bottom-color:white;
96100
border-left-color:transparent;
97101
}
102+
.introjs-arrow.top-right {
103+
top: -10px;
104+
right: 10px;
105+
border-top-color:transparent;
106+
border-right-color:transparent;
107+
border-bottom-color:white;
108+
border-left-color:transparent;
109+
}
110+
.introjs-arrow.top-middle {
111+
top: -10px;
112+
left: 50%;
113+
margin-left: -5px;
114+
border-top-color:transparent;
115+
border-right-color:transparent;
116+
border-bottom-color:white;
117+
border-left-color:transparent;
118+
}
98119
.introjs-arrow.right {
99120
right: -10px;
100121
top: 10px;
@@ -154,8 +175,8 @@
154175
text-align: right;
155176
}
156177

157-
/*
158-
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
178+
/*
179+
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
159180
Changed by Afshin Mehrabani
160181
*/
161182
.introjs-button {
@@ -192,7 +213,7 @@
192213

193214
.introjs-button:hover {
194215
border-color: #bcbcbc;
195-
text-decoration: none;
216+
text-decoration: none;
196217
box-shadow: 0px 1px 1px #e3e3e3;
197218
}
198219

@@ -274,4 +295,4 @@
274295
width: 0;
275296
left: 50%;
276297
top: 50%;
277-
}
298+
}

0 commit comments

Comments
 (0)