jquery CSS processing, including CSS, location, size, etc.
One: CSS
| Use |
Description |
Example |
| CSS (NAME|PRO|[,VAL|FN]) |
To access the style properties of a matching element |
$("p").css("color");
$("p").css("color","red");
|
Two: Location
| Use |
Description |
Example |
|
|
Gets the relative offset of the matching element at the current viewport
The returned object contains two integer properties: Top and left, measured in pixels |
$("p:last").offset({ top: 10, left: 30 });
Offset (). Left specifies the coordinates of the label in HTML
Offset (). Top specifies the coordinates of the label in HTML
|
|
|
Gets the offset of the matching element relative to the parent element
The returned object contains two integer properties: Top and left |
Specifies the coordinates of the label relative to the parent label (relative) label |
|
|
Gets the offset of the top of a matching element relative to the scrollbar |
var p = $("p:first");$("p:last").text( "scrollTop:" + p.scrollTop() );
$ (window). scrolltop () get
$ (window). scrolltop (0) settings |
|
|
Gets the offset to the left of the matching element relative to the scrollbar |
var p = $("p:first");$("p:last").text( "scrollLeft:" + p.scrollLeft() );
$("div.demo").scrollLeft(300);
|
Three: Size
|
|
Description |
Example |
|
|
Gets the height value (px) of the currently calculated match element |
$("p").height();
$("p").height(20);
|
|
|
Gets the current calculated width value (px) of the first matching element |
$("p").width();
$("p").width(20);
|
|
|
Gets the inner area height of the first matching element
(including padding, excluding borders) |
var p = $("p:first");$("p:last").text( "innerHeight:" + p.innerHeight() );
|
|
|
Gets the inner area width of the first matched element (including padding, excluding borders). |
var p = $("p:first");$("p:last").text( "innerWidth:" + p.innerWidth() );
|
|
|
Gets the outer height of the first matching element (including padding and borders by default)
When set to True, the margin is calculated |
|
|
|
Gets the outer width of the first matching element (including padding and borders by default)
When set to True, the margin is calculated |
|
JQUERY-CSS processing