mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Initial cut * fix aos global reference * fix clearbladejs global references * fix cldr.js augmentations * fix codemirror compile errors (maybe) * fixup skipped files after merge * fix dwt/v13 * add missing references to adone * fix meteor (manually) * fix rangy * add missing file reference to react-blessed * fix react-dom? * bump codemirror to 3.2 * bump dwt to 3.2 * Add/remove OTHER_FILES.txt as needed. * bump react-codemirror to 3.2 * add references to slickgrid tests * add reference to strophe.js tests * add reference to strophe+fix types * add reference to waypoints test * Bump others to 3.9 * remove incorrectly added file * Use more explicit types reference paths * bump strophejs-plugin-roster TS version
78 lines
2.5 KiB
TypeScript
78 lines
2.5 KiB
TypeScript
/// <reference types="../waypoints/jquery" />
|
|
// All code examples below taken from http://imakewebthings.com/waypoints/guides/getting-started/
|
|
|
|
declare function notify(text: string): void;
|
|
|
|
// A Basic Waypoint
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
const waypoint1 = new Waypoint({
|
|
element: document.getElementById('basic-waypoint')!,
|
|
handler() {
|
|
notify('Basic waypoint triggered');
|
|
}
|
|
});
|
|
|
|
// Directions
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
const waypoint2 = new Waypoint({
|
|
element: document.getElementById('direction-waypoint')!,
|
|
handler(direction) {
|
|
notify('Direction: ' + direction);
|
|
}
|
|
});
|
|
|
|
// Offsets
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
const waypoint3 = new Waypoint({
|
|
element: document.getElementById('px-offset-waypoint')!,
|
|
handler(direction) {
|
|
notify('I am 20px from the top of the window');
|
|
},
|
|
offset: 20
|
|
});
|
|
|
|
// this?
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
const waypoint4 = new Waypoint({
|
|
element: document.getElementById('element-waypoint')!,
|
|
handler(direction) {
|
|
notify(`${this.element.id} triggers at ${this.triggerPoint}`);
|
|
},
|
|
offset: '75%'
|
|
});
|
|
|
|
// JQuery adapter
|
|
// All code examples below taken from http://imakewebthings.com/waypoints/guides/jquery-zepto/
|
|
|
|
import $ = require('jquery');
|
|
|
|
// $.fn.waypoint
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
const waypoints10 = $('#options-only').waypoint({
|
|
handler: function fn(this: Waypoint, direction?: string) {
|
|
notify(this.element.id + ' hit');
|
|
}
|
|
});
|
|
|
|
const waypoints11 = $('#handler-first').waypoint(function() {
|
|
notify(this.element.id + ' hit 25% from top of window');
|
|
}, {
|
|
offset: '25%'
|
|
});
|
|
|
|
const waypoints12 = $('#handler-only').waypoint(function() {
|
|
notify(this.element.id + ' hit');
|
|
});
|
|
|
|
// Context Option
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
const waypoints13 = $('#context-example-offset').waypoint({
|
|
handler: function fn(this: Waypoint, direction?: string) {
|
|
notify('Hit midpoint of my context');
|
|
},
|
|
context: '#overflow-scroll-offset',
|
|
offset: '50%'
|
|
});
|