In the operations on the class attribute, the element style has actually been changed, but these are indirectly effective according to the configured CSS rules. Therefore, it is necessary to change the previously set CSS rules in a more direct way.
CSSBasic Property Processing
Method |
Description |
Css (name) |
Obtains the name attribute value in the CSS rule on an element. |
Css (name, value) Css (name, fn (index, value )) Css ({name1: value1,..., NameN: valueN }) |
Set the value of the CSS rule name attribute on an element to value. You can also use function parameters without explanation. You can also set multiple CSS attributes for the same element at a time. |
CSSDimension attribute Processing
Method |
Description |
Height () |
Obtains the height value of the element CSS attribute. |
Width () |
Obtains the width value of the element CSS attribute. These two methods obtain the actual height and width values of the elements on the page. They are mostly used for mathematical operations and are more convenient. |
InnerHeight () |
Obtains the actual height value of the element's internal area (including the padding ). |
InnerWidth () |
Obtains the actual width of the area inside the element. |
OuterHeight () |
Obtains the actual height of the element's external area (including the padding and border ). |
OuterWidth () |
Obtains the actual width of the external area of an element. To include the margin, You can input a true parameter, namely, outerHeight (true) or outerWidth (true) |
CSSLocation attribute Processing
Method |
Description |
Offset () Offset (coord) Offset (fn (index, coord )) |
Obtains the relative offset of an element in the current window and returns an object containing the top and left attributes. For example, $ ("p"). offset (). top. This method is only valid for visible elements. You can also set the offset value. Note that coord is also an object, such as $ ("p"). offset ({"top": 40, "left": 15 }) |
Position () |
Returns an object that contains the top and left attributes. |
ScrollTop () ScrollTop (value) |
Obtains the Offset Value of the vertical scroll bar relative to the top of the element. |
ScrollLeft () ScrollLeft (value) |
Obtains the Offset Value of the horizontal scroll bar relative to the leftmost side of the element. The default unit is px. If the value is negative, the scroll bar is moved to the top or left side. If the value exceeds the maximum value, it is moved to the bottom or right side. |