The associated instance of JQZK.jq, the object returned by jq(...)
.
Static
eventStatic
src0Makes the position of the first selected element as absolute. In addition to changing the style's position to absolute, it will store the location such that it can be restored later when relativize is called.
zk('abc').absolutize()
jq(el).zk.center('left top');
jq(el).zk.center('left center');
jq(el).zk.center('left'); //not to change the Y coordinate
jq(el).zk.center(); //same as 'center'
Positions the first selected element at the particular location of the browser window.
jq(el).zk.center('left top');
jq(el).zk.center('left center');
jq(el).zk.center('left'); //not to change the Y coordinate
jq(el).zk.center(); //same as 'center'
Optional
flags: stringA combination of center, left, right, top and bottom. If omitted, center is assumed.
the cumulative offset of the first matched element from the top left corner of the document.
It actually adds the cumulative offsetLeft and offsetTop of an element and all its parents.
Note that it ignores the scroll offset. If you want the element's coordinate, use revisedOffset instead.
Note that all values are returned as numbers only although they are expressed in pixels.
Optional
excludeMargin: booleanwhether to subtract the margins, too.
the content height of the element, which substracted the height of its CSS border or padding, unlike revisedHeight, the contentHeight will ignore the box-sizing with border-box.
7.0.0
Optional
excludeMargin: booleanwhether to subtract the margins, too.
the content width of the element, which substracted the width of its CSS border or padding, unlike revisedWidth, the contentWidth will ignore the box-sizing with border-box.
7.0.0
Optional
revised: booleanif revised is true, revisedOffset will be used (i.e., the offset is calibrated).
the dimension of the specified element.
If revised not specified (i.e., not to calibrate), the left and top are the offsetLeft and offsetTop of the element.
Disallows the user to select a portion of its content. You usually invoke this method to disable the selection for button-like widgets. By default, all elements can be selected (unless disabled with CSS -- which not all browsers support).
If you disable the selection in Widget#bind_, you shall enable it back in Widget#unbind_ since this method will register a DOM-level listener for certain browsers.
Allows the user to select a portion of its content. You usually invoke this method to undo disableSelection. By default, all elements can be selected (unless disabled with CSS -- which not all browsers support).
Sets the focus to the first matched element. It is the same as jq(n).focus() and n.focus, except
In general, it is suggested to use zk(n).focus(), unless n does not belong to any widget.
Optional
timeout: numberthe number of milliseconds to delay before setting the focus. If omitted or negative, the focus is set immediately.
whether the focus is allowed to set to the element. Currently, only SELECT, BUTTON, INPUT and IFRAME is allowed.
Optional
strict: booleanwhether the visibility property must not be hidden, too. If false, only the style.display property is tested. If true, both the style.display and style.visibility properties are tested.
whether the first match element is really visible. By real visible we mean the element and all its ancestors are visible.
Optional
strict: booleanwhether the visibility property must not be hidden, too. If false, only the style.display property is tested. If true, both the style.display and style.visibility properties are tested.
whether the first matched element is visible. false
if not exist; true
if no style attribute.
Creates a virtual parent for the specified element. Creating a virtual parent makes the specified element able to appear above any other element (such as a menu popup). By default, the Z order of an element is decided by its parent and ancestors (if any of them has the relative or absolute position). If you want to resolve this limitation, you can create a virtual parent for it with this method.
To undo the creation of the virtual parent, use undoVParent.
Notice that, due to browser's limitation, creating a virtual parent is still not enough to make an element appear on top of all others in all conditions. For example, it cannot in IE6 if there is a SELECT element underneath. To really solve this, you have to create a so-called stackup, which is actually an IFRAME element. By position the iframe right under the element, you can really want it appear on top. Refer to jq.newStackup for more information.
This method actually moves the element to the topmost level in the DOM tree (i.e., as the child of document.body), and then the original parent (the parent before calling this method) becomes the virtual parent, which can be retrieved by vparentNode.
When you implement a widget that appears above others, such as an overlapped window, a menu popup and a dropdown list, you can invoke this method when Widget#bind_ is called. And then, restore it by calling undoVParent when Widget#unbind_ is called.
Position the first matched element to the specified location.
Optional
dim: Dimensionthe dimension of the anchor location
Optional
where: stringwhere to position. Default: overlap
Allowed values:
Optional
opts: PositionOptionsa map of addition options. Allowed values include
Position the first matched element to the specified location.
Forces the browser to redo (re-apply) CSS of all matched elements.
Notice that calling this method might introduce some performance penality.
Optional
timeout: numbernumber of milliseconds to wait before really re-applying CSS. 100 is assumed if not specified , -1 means re-applying css right now.
Optional
opts: Partial<RedoCSSOptions>Makes the position of the element as relative. In addition to changing the style's position to relative, it tries to restore the location before calling absolutize.
the height to be assigned to the first matched element.
Optional
excludeMargin: booleanwhether to subtract the margins, too. You rarely need this unless the height is specified in term of the parent's perspective.
the revised (calibrated) height, which subtracted the height of its CSS border or padding, for the first matched element if the box-sizing is not in the border-box mode.
It is usually used to assign the height to an element (since we have to subtract the padding). ```ts el.style.height = zk(parentEL).revisedHeight(100); ```
Converts the specified offset in the element's coordinate to to the browser window's coordinateReturns the revised (calibrated) offset, i.e., the offset of the element related to the screen.
It is calculated by subtracting the offset of the scrollbar (scrollOffset and jq.innerX), for the first matched element.
Optional
ofs: Offsetthe offset to revise. If not specified, the first matched element's bounding rectange is assumed.
the revised (i.e., browser's coordinate) offset of the selected element. In other words, it is the offset of the left-top corner related to the browser window.
the width to be assigned to the specified element.
Optional
excludeMargin: booleanwhether to subtract the margins, too. You rarely need this unless the width is specified in term of the parent's perspective.
the revised (calibrated) width, which subtracted the width of its CSS border or padding, for the first matched element if the box-sizing is not in the border-box mode.
It is usually used to assign the width to an element (since we have to subtract the padding). ```ts el.style.width = zk(parentEL).revisedWidth(100); ```
Calculates the cumulative scroll offset of the first matched element in nested scrolling containers. It adds the cumulative scrollLeft and scrollTop of an element and all its parents.
It is used for calculating the scroll offset of an element that is in more than one scroll container (e.g., a draggable in a scrolling container which is itself part of a scrolling document).
Note that all values are returned as numbers only although they are expressed in pixels.
the cumulative scroll offset.
Selects the first matched element. It is the same as DOMElement.select, except it won't throws an exception (rather, returns false), and can delay the execution for the specified number of milliseconds.
Optional
timeout: numberthe number of milliseconds to delay before setting the focus. If omitted or negative, the focus is set immediately.
whether the element supports the select method. In other words, it returns false if the object doesn't have the select method.
Sets the selection range of the specified input-type element.
the starting index of the selection range
Optional
end: numberthe ending index of the selection rane (excluding). In other words, the text between start and (end-1) is selected.
Sets the CSS style with a map of style names and values. For example,
jq(el).css({width:'100px', paddingTop: "1px", "border-left": "2px"});
jq(el).css(jq.parseStyle(jq.filterTextStle('width:100px;font-size:10pt')));
To parse a style (e.g., 'width:10px;padding:2px') to a map of style names and values, use jq.parseStyle.
As of release 5.0.2, use jq.css(map) instead
the areas is abbreviation for left "l", right "r", top "t", and bottom "b". So you can specify to be "lr" or "tb" or more.
an array of styles, such as jq.paddings, jq.margins or jq.borders.
the summation of the specified styles. For example,
jq(el).zk.sumStyles("lr", jq.paddings);
//sums the style values of jq.paddings['l'] and jq.paddings['r'].
Optional
text: stringthe content text
the size of the text if it is placed inside the first matched element.
Use textWidth instead for better performance.
Undoes the creation of a virtual parent of the first matched element.
Refer to makeVParent for more information.
Optional
real: booleanwhether to return DOM element's parentNode if
no virtual parent. In other words, zk(n).vparentNode(true)
is the same as zk(n).vparentNode()||n.parentNode
.
the virtual parent of the first matched element.
Refer to makeVParent for more information.
Static
fixStatic
min
Import
zk.Widget Represents the object returned by the
zk
function, or by jq.zk. For example,zk('#id');
Refer to JQZK.jq for more information.
Other Extension