mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
jquery-fullscreen type definitions (https://github.com/kayahr/jquery-fullscreen-plugin)
This commit is contained in:
36
jquery-fullscreen/jquery-fullscreen-tests.ts
Normal file
36
jquery-fullscreen/jquery-fullscreen-tests.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/// <reference path="jquery-fullscreen.d.ts"/>
|
||||
|
||||
//
|
||||
// Examples from https://github.com/kayahr/jquery-fullscreen-plugin
|
||||
//
|
||||
|
||||
function enteringFullScreen() {
|
||||
|
||||
$(document).fullScreen(true);
|
||||
$('#myVideo').fullScreen(true);
|
||||
}
|
||||
|
||||
function exitingFullScreen() {
|
||||
|
||||
$(document).fullScreen(false);
|
||||
$('#myVideo').fullScreen(false);
|
||||
}
|
||||
|
||||
|
||||
function queryingFullScreenMode() {
|
||||
|
||||
//The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active,
|
||||
// false if not active or null when the browser does not support fullscreen mode at all
|
||||
var isFullScreen = $(document).fullScreen() != null;
|
||||
}
|
||||
|
||||
function fullScreenNotifications() {
|
||||
|
||||
$(document).bind("fullscreenchange", () => {
|
||||
console.log("Fullscreen " + ($(document).fullScreen() ? "on" : "off"));
|
||||
});
|
||||
|
||||
$(document).bind("fullscreenerror", () => {
|
||||
alert("Browser rejected fullscreen change");
|
||||
});
|
||||
}
|
||||
28
jquery-fullscreen/jquery-fullscreen.d.ts
vendored
Normal file
28
jquery-fullscreen/jquery-fullscreen.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for jquery-fullscreen 1.1.5
|
||||
// Project: https://github.com/kayahr/jquery-fullscreen-plugin
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
|
||||
/**
|
||||
* You can either switch the whole page or a single HTML element to fullscreen mode
|
||||
* This only works when the code was triggered by a user interaction (For example a onclick event on a button). Browsers don't allow entering fullscreen mode without user interaction.
|
||||
* Fullscreen mode is always exited via the document but this plugin allows it also via any HTML element. The owner document of the selected HTML element is used
|
||||
*/
|
||||
fullScreen(fullScreen: boolean): JQuery | boolean;
|
||||
|
||||
/**
|
||||
* The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active,
|
||||
* false if not active or null when the browser does not support fullscreen mode at all
|
||||
*/
|
||||
fullScreen(): boolean;
|
||||
|
||||
/**
|
||||
* The plugin provides another method for simple fullscreen mode toggling
|
||||
*/
|
||||
toggleFullScreen(): JQuery | boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user