jQurey (size, css operation, effect, traversed)

size:

height (): Set or returns an element height (not including padding, borders or margins).

width (): returns the width of an element or disposed (not including padding, borders or margins).

E.g:

 $("#box").height("500px").width("500px");  

css operations:

Set style:

Single style:

$("p").css("background-color","yellow");

Multiple styles:

$("p").css({"background-color":"yellow","font-size":"200%"});

 

 

 

effect:

Hide and show: hide () and show ()

fade in and fade out:

fadeIn (speed, callback), fadeOut (speed, callback), fadeToggle () method can be switched, fadeTo (speed, opacity, callback) between the fadeIn (). fadeOut and () method

slide:

$(selector).slideDown(speed,callback);$(selector).slideUp(speed,callback);$(selector).slideToggle(speed,callback);

jq chain line is a wireless language can be added later.

Traversal:

ancestor:

1.parent () method returns the immediate parent element selected element

2.parents () method returns the ancestor of all the elements of the selected element, it is all the way up until the document root element (<html>)

3.parentsUntil () method returns all ancestor elements interposed between elements of the selected element in brackets. It does not contain the selected element is selected from elements in parentheses.

 

Offspring:

1.children () method returns all direct child elements of the selected element.

2.find () method returns the descendent elements of the selected element, all the way down to the last generations.

Compatriots:

1.siblings () method returns all elements of the selected element compatriots.

2.next () method returns a fellow next element of the selected element.

3.nextAll () method returns all elements follow countrymen selected element.

4.nextUntil () method returns all fellow follower element interposed between two given parameters.

Work 5.prev (), prevAll () and prevUntil () method and a method similar to the above.

 

filter:

1.first () method returns the selected elements of the first element.

2.last () method returns the last element of the selected element.

3.eq () method returns the element is designated with the index number of the selected element.

4.filter () method returns the element meet certain conditions.
This method allows you to specify a condition. Ineligible elements removed from the selection, qualifying element will be returned.
The method generally used to narrow the search elements are combined in the selected element.

5.not () method returns all elements that do not match the criteria. not () method with the filter () instead.

6.slice () is reduced to the set of matched elements specified subset index range.

$('li').slice(2, 4).css('background-color', 'red');

each (): the meaning of each

$("li").each(function(){
       $(this).attr();
    })

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/www1842564021/p/11856634.html