Home >Web Front-end >JS Tutorial >Usage of fadeIn (fade in) fadeOut (fade out) in jquery

Usage of fadeIn (fade in) fadeOut (fade out) in jquery

巴扎黑
巴扎黑Original
2017-06-30 10:12:203493browse

jquery's fade-in and fade-out events fadeIn fadeOut

1. The fadeIn() method uses the fade-in effect to display the selected element (the element is hidden)

$(selector).fadeIn(speed,callback)

Parameter description speed, optional. Specifies how quickly an element goes from hidden to visible. Default is "normal". Possible values: milliseconds (e.g. 1500) "slow" "normal" "fast"

callback,optional. The function to be executed after the fadeIn function is executed. (This parameter cannot be set unless the speed parameter is set)


2.fadeOut()

fadeOut(speed, [ callback]) achieves the fade-out effect of all matching elements through changes in opacity, and optionally triggers a callback function after the animation is completed.

This animation only adjusts the opacity of the element, which means that the height and width of all matching elements will not change.

A string of one of three predetermined speeds("slow", "normal", or "fast") or a millisecond value indicating the animation duration (such as: 1000)



3. BUG that the fadeIn and fadeOut methods of jquery under IE are invalid


BUG1 ; Absolute positioning of nested images that are larger than the parent size                                                                                                                                                                                                                                     used to be used to embed images that are larger than the size of their parent. () fadeOut() bug

                                                                                                                                 ’ ‐ ’ s ’ t ‐ ‐ ‐ ‐ ‐ to 1 to 3 to 1 to 1 to 1 to 1 to 10 seconds. Solution: Dynamically changed its posity property to related before Fadein () to relative; it will solve the bug

# $ ('. FADEIN'). 'relative').fadeIn();

                                                                                                                                                            to be added to elements with position attributes in your sub-elements. Add filter: inherit; to the first-level sub-elements of the current element. Once these two are combined, the problems of IE678 will be solved

            .relative{position: relative; filter: inherit}

The above is the detailed content of Usage of fadeIn (fade in) fadeOut (fade out) in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn