In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "jquery how to achieve automatic element disappearance and display", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "jquery how to achieve automatic element disappearance and display" bar!
Methods: 1, the use of fadeOut () method to make the element automatically disappear and execute the specified function, the syntax is "$(element). FadeOut (the speed of disappearance, the specified function;)"; 2, in the specified function using the fadeIn () method to make the element display, the syntax is "$(element) .fadeIn (display speed)".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.
How to realize the automatic disappearance and display of elements by jquery
In jquery, you can use the fadeOut () method, and the fadeIn () method to make the picture disappear slowly, and then automatically display another picture. Here is an example of how jquery makes the picture disappear and then displays another picture.
1. Create a new html file, named test.html, to explain how jquery makes the picture disappear slowly, and then automatically display another picture. Create a picture using the img tag and set its id to mypic.
In the js tag, the function function is executed when the page is loaded through the ready () method.
2. In the function function, get the img object through id, and use the fadeOut () method to realize that the picture slowly disappears within 3 seconds. After the picture disappears, execute its callback function function. The fadeOut () method uses the fade-out effect to hide the selected element if it is hidden.
In the callback function function, use the attr () method to change the path of the picture, replace it with another picture, and then use the fadeIn () method to make the picture display slowly. The fadeIn () method uses the fade effect to display the selected element if it is hidden.
Open the test.html file in the browser to see the effect of the implementation.
Thank you for your reading, the above is the content of "how to realize the automatic disappearance and display of elements in jquery". After the study of this article, I believe you have a deeper understanding of how to realize the automatic disappearance and display of elements in jquery, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.