Introductions for websites to guide step-by-step your users.
Introductions for websites to guide step-by-step your users.
Was inspired from intro.js and angular-intro.js
1 - Include introduction.min.js
and introduction.min.css
in your page.
2 - Add data-intro
and data-step
to your HTML elements. (cf. examples)
1 - Include introduction.min.js
and introduction.min.css
in your page.
2 - Include introduction.js
into your angular.module.
3 - Add directives ng-intro-options
and ng-intro-method
to your HTML elements in a controller. (cf. examples)
bower install introduction.js --save
`
Creating an introductionjs object.
Parameters:
#intro-farm
.Returns:
Example:
introductionjs() //without selector, start introduction for whole page
introductionjs("#intro-farm") //start introduction for element id='intro-farm'
`
Start the introduction for defined element(s).
Returns:
Example:
introductionjs().start()
`
Go to specific step of introduction.
Parameters:
Returns:
Example:
introductionjs().goToStep(2).start(); //starts introduction from step 2
`
Go to next step of introduction.
Returns:
Example:
introductionjs().start().nextStep();
`
Go to previous step of introduction.
Returns:
Example:
introductionjs().goToStep(3).start().previousStep(); //starts introduction from step 2
`
Exit the introduction.
Returns:
Example:
introductionjs().exit()
`
Set a single option to introductionjs object.
Parameters:
option : String
Option key name.
value : String/Number
Value of the option.
Returns:
Example:
introductionjs().setOption("skipLabel", "Exit");
`
Set a group of options to the introductionjs object.
Parameters:
Returns:
Example:
introductionjs().setOptions({ 'skipLabel': 'Exit', 'tooltipPosition': 'right' });
`
To refresh and order layers manually
Returns:
Example:
introductionjs().refresh();
`
Set callback for when introduction completed.
Parameters:
Returns:
Example:
introductionjs().oncomplete(function() {
alert("end of introduction");
});
`
Set callback to exit of introduction. Exit also means pressing ESC
key and clicking on the overlay layer by the user.
Parameters:
Returns:
Example:
introductionjs().onexit(function() {
alert("exit of introduction");
});
`
Set callback to change of each step of introduction. Given callback function will be called after completing each step.
The callback function receives the element of the new step as an argument.
Parameters:
Returns:
Example:
introductionjs().onchange(function(targetElement) {
alert("new step");
});
`
Given callback function will be called before starting a new step of introduction. The callback function receives the element of the new step as an argument.
Parameters:
Returns:
Example:
introductionjs().onbeforechange(function(targetElement) {
alert("before new step");
});
`
Given callback function will be called after starting a new step of introduction. The callback function receives the element of the new step as an argument.
Parameters:
Returns:
Example:
introductionjs().onafterchange(function(targetElement) {
alert("after new step");
});
`
data-intro
: The tooltip text of stepdata-step
: Optionally define the number (priority) of stepdata-tooltipClass
: Optionally define a CSS class for tooltipdata-highlightClass
: Optionally append a CSS class to the helperLayerdata-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
steps
: For defining steps using JSON configurationnextLabel
: Next button labelprevLabel
: Previous button labelskipLabel
: Skip button labeldoneLabel
: Done button labeltooltipPosition
: Default tooltip positiontooltipClass
: Adding CSS class to all tooltipshighlightClass
: Additional CSS class for the helperLayerexitOnEsc
: Exit introduction when pressing Escape button, true
or false
exitOnOverlayClick
: Exit introduction when clicking on overlay layer, true
or false
showStepNumbers
: Show steps number in the red circle or not, true
or false
keyboardNavigation
: Navigating with keyboard or not, true
or false
showButtons
: Show introduction navigation buttons or not, true
or false
showSkipButton
: Show skip button or not, true
or false
showBullets
: Show introduction bullets or not, true
or false
showProgress
: Show introduction progress or not, true
or false
showArrow
: Show arrow to dialog or not, true
or false
scrollToElement
: Auto scroll to highlighted element if it’s outside of viewport, true
or false
overlayOpacity
: Adjust the overlay opacity, Number
disableInteraction
: Disable an interaction inside element or not, true
or false
swipeNavigation
: Navigating with swipe or not, true
or false
swipeSensibility
: Swipe sensibilityng-intro-options="IntroOptions"
You should create a $scope.IntroOptions
in your controller which contains the introduction.js options. This also allows you to modify the options as part of your controller behavior if necessary. You don’t have to use IntroOptions
, you can specify some other name.
ng-intro-method="CallMe"
The directive will create a method on $scope.CallMe
so that you can invoke it yourself later. Make sure the there isn’t a method CallMe
already in your controller. To use the method be sure to wrap it with $timeout
. You don’t have to use CallMe
, you can specify some other name.
You can invoke it from an event such a click,
ng-click="CallMe();"
as long as you are still in the same controller scope. You can also specify a step number in the method call, CallMe(3);
.
You can start the intro from code, either call $scope.CallMe();
. If the $scope.CallMe();
doesn’t work, it might be because your DOM isn’t ready. Put it in a $timeout
.
If you set ng-intro-autostart="true"
, the intro will start as soon as the directive is ready.
If an intro tour includes dynamic content, use ng-intro-autorefresh="true"
to call introduction.js’ refresh method.
Introduction.js provides several callbacks. You can receive these callbacks in your controller. For example, for the onchange
event, specify the function name in the directive.
ng-intro-onchange="ChangeEvent"
In your controller, create ChangeEvent
$scope.ChangeEvent = function (targetElement, scope) {
console.log("Change Event called");
console.log(targetElement); //The target element
console.log(this); //The introductionjs object
};
The other introduction.js callbacks you can specify are ng-intro-oncomplete
, ng-intro-onexit
, ng-intro-onchange
ng-intro-onbeforechange
and ng-intro-onafterchange
.
ng-intro-exit-method="ExitMe"
Then in your controller, you can force exit using
$scope.ExitMe(function() { //callback } );
npm test
`
grunt build
`