jQuery CSS operation (study notes)

CSS () sets or returns the style property matching elements
return CSS property value: $ (selector) .css (name )
Parameters: name: name of the CSS predetermined attribute, the parameters may include any CSS property
set CSS property:
$ (Selector) .css (name, value)
parameters: name: Specifies the name of a CSS property, this parameter can contain any CSS property
value: the value of specified CSS property
$ (Selector) .css (name: value, name: value ... ...)
$ ( selector) .css (function (index, value))
parameter function (): returns the specified attribute worthy CSS function
index- Alternatively, the selector receiving position index
value- Alternatively, the current value of the received CSS property

height () is provided to match the height of the element or returns
Returns the height of the element: ( s e l e c t O r ) . h e i g h t ( ) : (Selector) .height () to set the height of the element: (Selector) .height (length)
Parameters length: specified height of the element, if not specified unit of length, the default px unit
$ (selector) .height (function (
parameter function (index, oldheight): returns a new function is selected from a predetermined height of the element.
index-selectable, i.e. the selected element selector position index (0 ~ index)
oldheight- Alternatively, receiving the current value of the selector

width () sets or returns the element's width
and height almost

offset () returns the first matching element or set position relative to the document
objects returned by this method comprises two integer properties: top, left, to the pixel units of measurement, this method is only visible elements
return offset coordinates:
$ (selector) .offset ()
to set the offset coordinates:
$ (Selector) .offset (value)
parameter tree value: in pixels have a predetermined top and left coordinates, value is a reference to give the object tree format example: {left: 33 , Top: 33 is)
$ (Selector) .offset (function (index, oldoffset)
parameter function (index, oldoffset): this function must return an object this object contains two attributes: top, left (the object name is not important, since What can be)
index-selectable. selector receiving position index obtained
oldoffset- Alternatively, to obtain the coordinates of the current receiver selector

the offsetParent () returns the latest positioning ancestors element (element means positioning element is provided to obtain position property relative, abstract, fixed element
in this method is only this element is selected, the operation does not make any

position () returns the first matching element relative to the parent element of
the object returned by this method comprises two integer properties: top, left (in pixels), this method is only visible elements

the scrollLeft () Returns or matching elements disposed offset relative to the left side of the scroll bar, i.e. the horizontal position matching the scroll bar elements of
which element the visible and invisible elements are valid
when the acquired value, the method returns the first matching element the left offset Scroll
$ (Selector) .scrollLeft ()
when set and which is provided all matched elements left offset Scroll
$ (Selector) .scrollLeft (offset)
parameter offset: in pixels, without units

scrollTop () Returns or matching elements disposed offset relative to the scroll bar at the top, i.e., the vertical scroll position matching elements
which are effective elements for visible and invisible elements
when acquiring value, the method returns the first matching element Top offset Scroll
$ (Selector) .scrollTop ()
when set and which is provided all matched elements Top offset Scroll
$ (Selector) .scrollTop (offset)

Guess you like

Origin blog.csdn.net/qq_44858021/article/details/90722768