
Trip.js is a useful plugin that can help you customize a tutorial trip easily. ( Based on jQuery )
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="src/trip.css">
<script type="text/javascript" src="src/trip.js"></script>
var trip = new Trip([
{
sel : $('#element1'),
content : 'This is element 1'
},
{
sel : $('#element2'),
content : 'This is element 2'
}
], options); // details about options are listed below$(document).ready(function({
trip.start();
});$(document).ready(function() {
var trip = new Trip([
{
sel : $('.step1'),
position : 'n',
content : 'Hi, I am Trip.js',
delay : 2000,
callback : function(i) {
console.log("step "+ i +" is finished");
}
},
{
sel : $('.step2'),
position : 'e',
content : 'This is a plugin that can help you make hint flow easily !',
delay : 3000,
callback : function(i) {
console.log("step "+ i +" is finished");
}
},
{
sel : $('.step3'),
position : 'n',
content : 'Can be placed in many directinos - North',
delay : 2000
},
{
sel : $('.step4'),
position : 'e',
content : 'East',
delay : 2000
},
{
sel : $('.step5'),
position : 'w',
content : 'West',
delay : 2000
},
{
sel : $('.step6'),
position : 's',
content : 'South',
delay : 2000
},
{
sel : $('.step7'),
position : 'n',
content : 'One more thing, plz read this !',
expose : true,
delay : 7000
}
], {
onTripStart : function() {
console.log("onTripStart");
},
onTripEnd : function() {
console.log("onTripEnd");
},
onTripStop : function() {
console.log("onTripStop");
},
backToTopWhenEnded : true,
delay : 2000
});
$(".start-tour").click(function() {
trip.start();
});
});You can set tripIndex ( start from 0 ) to specific trip block at start.
Default :
$.noop
You can set a callback function triggered when the trip starts.
Default :
$.noop
You can set a callback function triggered when the trip ends.
Default :
$.noop
You can ask Trip.js go back to top when ended.
Default :
false
You can set the basic zIndex for overlay if you want to expose elements.
Default :
99999
You can decide to bind key events for trip navigations or not.
Default :
true
every trip will be lived for 1 second (1000 ms) by default
Default :
1000
Which selector is referenced in this step.
Default :
no default
What information that you want to show to users.
Default :
no default
What position would you prefer for the tripBlock.
Default :
n( You can use e, w, n, s four positions )
You can delay longer / shoter for this step. You can assign
delay
in global options to change the default delay.
Default :
1000
You can do whatever you want to do after this step passed. BTW, Trip.js will assign the current
tripIndex
(start from 0) as the first parameter back to your callback function for later use.
Default :
$.noop
Go to next trip
Go back to previous trip
pause / continue
Stop
Call this method to start your trip
Call this method to stop your trip
Call this method to pause/continue your trip
jump to next step
jump back to previous step
This plugin is still under development ! If you find any bugs or want me to implement anything, please feel free to open an issue ;)