Next, go to the console tab and type the following command: $('.logo').fadeOut() Īs you press enter, notice that the jQuery logo slowly disappears from the page. To select a single element, use the id attribute. NOTE: When using a class as a selector, all the elements to which the class is applied are selected. Let us look at some of the examples of the fadeOut() method. The higher the duration, the slower is the fading animation. Once it reaches zero, the display property is set to none. Over the duration of the fading out activity, the opacity of the element is gradually decreased. So, how does the fadeOut method achieve its goal? Simple answer, it plays with the CSS opacity and displays properties of the element. The possible values are ‘swing’ or ‘linear’, the former being the default. It expected another string-typed parameter that would define the type of transition during the animation. The jQuery v1.4.3 introduced another variation of the fadeOut method. A very important point to note here is that the callback function is called once for each element. The complete is a callback function that is called once the fading-out animation is complete. If this argument is not supplied, the default value of 400 milliseconds is applied. Here duration is the time in milliseconds for the fading animation effect. The advanced syntax expects some parameters as follows: $().fadeOut(, ) The value 400 is the default value of the duration parameter. This method will fade the element in 400 milliseconds.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |