ElementUtils API
isDocumentInFullscreenMode()
Determines whether the current document is in fullscreen mode.
type:
function
tsfunction ElementUtils(): boolean;
example
tsimport { ElementUtils } from "@shihongxins/utils"; // false console.log(ElementUtils.isDocumentInFullscreenMode());
toggleElementFullscreen()
Toggles the Element Full Screen state.
type:
function
tsfunction toggleElementFullscreen(target: Element, options: FullscreenOptions): Promise<unknown>;
example
tsimport { ElementUtils } from "@shihongxins/utils"; ElementUtils.toggleElementFullscreen(document.body);
listenElementHorizontalScrolling()
Listen for wheel events to make elements scroll horizontally.
type:
function
tsfunction listenElementHorizontalScrolling( target: HTMLElement, options?: { altkey: boolean; force: boolean; } ): void;
example
tsimport { ElementUtils } from "@shihongxins/utils"; const elemThatScrollHozOnWhell = document.querySelector("elemThatScrollHozOnWhell"); ElementUtils.listenElementHorizontalScrolling(elemThatScrollHozOnWhell);
getElementStyleProp()
Gets the style properties of the element after calculation.
type:
function
tsfunction getElementStyleProp(target?: Element, propName?: string): void | string;
example
tsimport { ElementUtils } from "@shihongxins/utils"; // "16px" console.log(ElementUtils.getElementStyleProp("fontSize"));