How jquery operates on CSS properties

Source: Internet
Author: User
1. Preface

jquery provides several ways to manipulate the CSS styles of DOM elements, including direct access to and modification of the class property values of DOM elements, as well as access to and modification of CSS property values in DOM elements, as well as a number of ways to directly access and modify the size and position of DOM elements.

jquery provides the following methods for manipulating CSS properties.

1) AddClass (Class): Adds the specified CSS definition to all DOM objects contained in the jquery object.

2) Hasclass (Class): Determines whether the jquery object contains at least one DOM object with the specified CSS definition.

3) Removeclass (Class): Deletes the specified CSS definition on all DOM objects contained by the jquery object.

4) Toggleclass: If you add a Jquey object that has the specified CSS definition on all DOM objects contained in it, delete the CSS definition or add the CSS definition.

5) CSS (name): Returns the value of the CSS property named Naem on the first matching DOM object that the jquery object contains.

6) Cssname,value): Sets a single CSS property value for all DOM objects contained in the jquery object.

7) CSS (properties): Set multiple CSS property values for all DOM objects contained in the jquery object.

8) offset (): Gets the location of the first matching DOM object that the jquery object contains relative to the document.

9) position (): Gets the position of the first matching DOM object that the jquery object contains relative to its parent element.

ScrollTop (): Gets the scroll top value of the first match for all DOM objects contained in the jquery object.

ScrollTop (val): Sets the scrollleft value of all DOM objects contained in the jquery object.

ScrollLeft (): Gets the scrollleft value of all DOM objects contained by the jquery object.

ScrollLeft (val): Gets the scrollleft value of all DOM objects contained by the jquery object.

Height: Returns the current height (in px) of the first matching element in a jquery object

) Height (val): Sets the height of all elements in the jquery object, and Val is px.

() width (): Returns the width of all elements in the jquery object (in px)

Width (val): Sets the width of all elements in the jquery object, and Val is px. 2. Example

The following program demonstrates the development of custom CSS Properties

 <! DOCTYPE html>  

3. Running Results

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.