mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
Merge pull request #5053 from Anahkiasen/feature/intro-js
Add introjs definition
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/// <reference path="intro.js.d.ts" />
|
||||
|
||||
var intro = introJs();
|
||||
|
||||
intro.setOption('doneLabel', 'Next page');
|
||||
intro.setOptions({
|
||||
steps: [
|
||||
{
|
||||
intro: "Hello world!"
|
||||
},
|
||||
{
|
||||
element: document.querySelector('#step1'),
|
||||
intro : "This is a tooltip."
|
||||
},
|
||||
{
|
||||
element : document.querySelectorAll('#step2')[0],
|
||||
intro : "Ok, wasn't that fun?",
|
||||
position: 'right'
|
||||
},
|
||||
{
|
||||
element : '#step3',
|
||||
intro : 'More features, more fun.',
|
||||
position: 'left'
|
||||
},
|
||||
{
|
||||
element : '#step4',
|
||||
intro : "Another step.",
|
||||
position: 'bottom'
|
||||
},
|
||||
{
|
||||
element: '#step5',
|
||||
intro : 'Get it, use it.'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
intro.start()
|
||||
.nextStep()
|
||||
.previousStep()
|
||||
.goToStep(2)
|
||||
.exit()
|
||||
.refresh()
|
||||
.onbeforechange(function (element) {
|
||||
element.getAttribute('class');
|
||||
})
|
||||
.onafterchange(function (element) {
|
||||
element.getAttribute('class');
|
||||
})
|
||||
.onchange(function () {
|
||||
alert('Changed');
|
||||
})
|
||||
.oncomplete(function () {
|
||||
alert('Done');
|
||||
});
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
// Type definitions for intro.js 1.0.0
|
||||
// Project: https://github.com/usablica/intro.js
|
||||
// Definitions by: Maxime Fabre <https://github.com/anahkiasen/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module IntroJs {
|
||||
enum Positions {
|
||||
top,
|
||||
left,
|
||||
right,
|
||||
bottom
|
||||
}
|
||||
|
||||
interface Step {
|
||||
intro: string;
|
||||
element?: string|HTMLElement;
|
||||
position?: Positions;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
nextLabel?: string;
|
||||
prevLabel?: string;
|
||||
skipLabel?: string;
|
||||
doneLabel?: string;
|
||||
tooltipPosition?: string;
|
||||
tooltipClass?: string;
|
||||
highlightClass?: string;
|
||||
exitOnEsc?: boolean;
|
||||
exitOnOverlayClick?: boolean;
|
||||
showStepNumbers?: boolean;
|
||||
keyboardNavigation?: boolean;
|
||||
showButtons?: boolean;
|
||||
showBullets?: boolean;
|
||||
showProgress?: boolean;
|
||||
scrollToElement?: boolean;
|
||||
overlayOpacity?: number;
|
||||
positionPrecedence?: string[];
|
||||
disableInteraction?: boolean;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
interface IntroJs {
|
||||
start(): IntroJs;
|
||||
exit(): IntroJs;
|
||||
|
||||
goToStep(step: number): IntroJs;
|
||||
nextStep(): IntroJs;
|
||||
previousStep(): IntroJs;
|
||||
|
||||
refresh(): IntroJs;
|
||||
|
||||
setOption(option: string, value: string|number): IntroJs;
|
||||
setOptions(options: Options): IntroJs;
|
||||
|
||||
onexit(callback: Function): IntroJs;
|
||||
onbeforechange(callback: (element: HTMLElement) => any): IntroJs;
|
||||
onafterchange(callback: (element: HTMLElement) => any): IntroJs;
|
||||
onchange(callback: Function): IntroJs;
|
||||
oncomplete(callback: Function): IntroJs;
|
||||
}
|
||||
|
||||
interface Factory {
|
||||
(element?: string): IntroJs;
|
||||
}
|
||||
}
|
||||
|
||||
declare var introJs: IntroJs.Factory;
|
||||
declare module 'intro.js' {
|
||||
export = IntroJs;
|
||||
}
|
||||
Reference in New Issue
Block a user