The jquery.tutorialOverlay plugin is a UI widget used to orient a user to a page that is either newly redesigned or is highly interactive. It serves to point out key interface elements in context of viewing a specific screen. It is used to explain the use of 1-5 features in a way that is quickly read and then dismissed.
Features
Content
An overlay can display arbitrary content centered on the screen. This may be a button, and white window-like panel, or any other object.
Tips/callouts can be specified to appear relative to an element on the underlaying screen. Each tip may be an image, text, or any other object.
Unobtrusive syntax
Overlays can be created with a simple markup-based syntax, or, if you need more control, you can use the JavaScript API.
Using the skinny.js Download Builder, create a custom build which includes jquery.tutorialOverlay, along with any other skinny.js libraries you want. Include the following CSS and JavaScript files:
Creating an overlay
Overlays are designed to be used unobtrusively, but the entire programmatic API is exposed as well.
Tutorial Overlays can be specified in the HTML via the tutorial-overlay class. Any element within this overlay element that has the tutorial-overlay-tip class will be a tip on the overaly. The main content to render in the center of the overlay is indicated with the tutorial-overlay-content class.
By default, any element with a class of close-overlay will close the overlay when clicked.
Here’s an example of unobtrusive usage:
To create an overlay programmatically, use one of the following methods:
When using the programmatic syntax to show overlays, you can use the following attributes to declaratively define settings for the overlay (note that these correspond exactly to the Settings you can pass to the tutorialOverlay programmatic API):
data-overlay-zindex: Can be used to set the z-index for the overlay. Don’t use this unless you need to participate in a pre-existing z-index arms race. Defaults to 10000.
//* data-overlay-destroyOnClose: If true, the overlay DOM will be destroyed and all events removed when the overlay closes. Defaults to ‘‘false’’.
data-overlay-hideOnClick: If true, the overlay will be closed when the user clicks on it. Defaults to ‘‘true’’.
Declarative tip attributes
When using the programmatic syntax to show overlays, you can use the following attributes to declaratively define settings for the tips/callouts in the overlay (note that these correspond exactly to the Settings you can pass to the tutorialOverlay programmatic API):
data-overlay-tip-target: Set the target element to which the the tip will be relatively positioned.
data-overlay-tip-position: “north”, “south”, “east”, or “west. Describes the desired position relative to the target element.
data-overlay-tip-color: The color of the tip arrow.
data-overlay-tip-offset: The number of pixels of space between the tip and the target.
Settings
$(selector).tutorialOverlay() (and $.tutorialOverlay.create()) takes a settings object as an argument. Here are the available settings:
zindex: Can be used to set the z-index for the overlay. Don’t use this unless you need to participate in a pre-existing z-index arms race. Defaults to 10000.
//* destroyOnClose: If true, the overlay DOM will be destroyed and all events removed when the overlay closes. Defaults to ‘‘false’’.
hideOnClick: If true, the overlay will be closed when the user clicks on it. Defaults to ‘‘true’’.
autoLoad: Specifies whether to show this overlay on page load.
Here’s an example. Note that you can (and usually should) do this all with data-overlay attributes:
Overlay object methods
$.tutorialOverlay.create() returns an overlay object with the following methods:
show(): Shows the overlay.
hide(): Closes the overlay.
destroy(): Removes the overlay from the DOM and removes all events.
isShowing(): Returns true iff the overlay is currently being displayed.
setHideOnClick(): Specify whether the overlay should hide when the user clicks on it.
addTip(): Add a tip to the overlay.
setCenterContent(): Set the content to display in the center of the overlay.
For example:
You can call any overlay methods using the jQuery idiomatic syntax as well: