UNPKG

xframelib

Version:

The accumulated front-end development foundation library originates from projects and serves projects.

60 lines (59 loc) 2.19 kB
import { ViewportOffsetResult } from '../model/ITypes'; /** * 模仿JQuery相关方法 */ declare class JQuery { /** * 是否有Style类名 * @param ele HTML元素 * @param className 类名 * @returns */ hasClass(ele: HTMLElement, className: string): RegExpMatchArray | null; /** * 为元素添加Style类名 * @param ele HTML元素 * @param className 类名 */ addClass(ele: HTMLElement, className: string): void; /** * 移除元素的Style类名 * @param ele HTML元素 * @param className 类名 */ removeClass(ele: HTMLElement, className: string): void; /** * 切换Style类名 * @param ele HTML元素 * @param className 类名 */ toggleClass(ele: HTMLElement, className: string): void; /** * 修改样式css参数 * @param propField * @param propValue */ setCSSProperty(ele: HTMLElement, propField: string, propValue: string | null): void; getBoundingClientRect(element: Element): DOMRect | number; /** * Get the left and top offset of the current element * left: the distance between the leftmost element and the left side of the document * top: the distance from the top of the element to the top of the document * right: the distance from the far right of the element to the right of the document * bottom: the distance from the bottom of the element to the bottom of the document * rightIncludeBody: the distance between the leftmost element and the right side of the document * bottomIncludeBody: the distance from the bottom of the element to the bottom of the document * * @description: */ getViewportOffset(element: Element): ViewportOffsetResult; hackCss(attr: string, value: string): any; on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void; off(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void; once(el: HTMLElement, event: string, fn: EventListener): void; } /** * jquery对象 */ export declare const jquery: JQuery; export {};