zootorial v0.4.12
zootorial
Tutorial
Constructor parameters
parentElement at which to insert the tutorial's elements
stepsObject of steps, see Steps below
firstThe key of the first step
demoLabel,nextLabel,doneLabelDefault labels for the "demo", "next", and "done" buttons
Properties
elContains all the tutorial content.
closeButtonAborts the tutorial
header,contentContains the
headerandcontentspecified in the current step, if defined.instructionIncludes the
instructionproperty in the current step and a button to call the step'sdemofunction if one is defined.footerContains the "next" button.
Methods
start()Start the tutorial.
end()End the tutorial.
goTo(step)If it's a string, go to that step in the
stepsobject.If it's a function, it's evaluated and the result is passed back to
goTo.If it's
false, the step will not change, but theinstructionelement will get adata-zootorial-attentionattribute.If it's
nullor not defined, the tutorial will end.
Helpers
triggerEvent(eventName)Dispatch a custom event from the tutorial's
elelement.createElement(tagAndClassNames, parent)Create an element (e.g. "button.hello") at a parent.
currentThe current step as it was passed into
steps
Hooks
onBeforeStart()onStart()onBeforeEnd()onEnd()onBeforeBeforeLoadStep()onLoadStep()onBeforeUnloadStep()onUnloadStep()
Events
Dispatched from el. You should probably reference these, e.g. addEventListener(tutorialInstance.startEvent, handler, false), in case the specific strings change
startEventendEventloadStepEventunloadStepEventabortEvent
"Step" objects
Parameters
headerString of HTML for a header
contentString of HTML for content
instructionString of HTML for instructional content
demo()Function that shows the user what to do. Check out my
ghost-mousefor a nice way to drive a dmeo.attachmentAn array
[X of tutorial, Y of tutorial, target selector, X of target, Y of target]. The tutorial dialog will be positioned so that the X and Y defined will match up with the X and Y of the target. E.g.[0, 0, '.target', 0, 0]will align the top-left corners of the tutorial and the target, and[0, 0.5, '.target', 1, 0.5]will stick the tutorial to the right side of the target, cenetered vertically.If
attachmentisfalse, the dialog will not move from the last step's position.progressThe number of progress dots to fill up
arrowSet the
data-zootorial-positionproperty, which you can then style apropriatelyblockA CSS selector; block clicks to the matched elements until the step is exited.
focusA CSS selector; the matched element will be "highlighted" (everything around it will be dimmed).
actionableA CSS selector; matched elements will be given a
data-zootorial-actionableproperty.nextIf it's an object, keys are event/selector combos (e.g.
click button[name='complete-task']) and values are passed to the tutorial'sgoTomethod when that event is dispatched from that selector. No "next" button is drawn.If it's a string, function,
null, or not defined, this is passed directly to the tutorial'sgoTomethod and either a "next" or "done" button is drawn in the footer.
Hooks
onBeforeLoad()onLoad()onBeforeUnload()onUnload()
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago