Home >Web Front-end >Front-end Q&A >What special effects can JavaScript do?
The special effects that JavaScript can do include: 1. Carousel; 2. Form verification; 3. Pop-up boxes on the page; 4. Multi-level tabs; 5. Animation on the web page; 6. Floating Advertisement; 7. Shaking pictures, etc.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
What special effects can JavaScript do?
js can very conveniently manipulate the DOM, so it can present various effects on the client. So what effects are achieved by js? Here are some common effects for novices to refer to, so that new students can have an idea of what js does. As long as you learn how to use the JavaScript language, you can easily create the following effects.
1. Carousel image: Carousel image is usually a place to switch images in the middle of the website, as shown in the figure below.
The effect of sliding pictures one by one. Its principle is actually very simple: the box displaying the picture in the middle can only accommodate the display of one picture. In fact, there is a height inside this box that is as high as the display box, but the width is much larger than the display box. This long large box contains There are several pictures placed side by side from left to right. These pictures are used for carousel. When displaying, you only need to change the exposed position of this long box. As shown below.
So how to achieve this effect through js: After the css layout is done to create such a small box nested in a large box, the effect of leaking a picture can be achieved by using css positioning technology , all js has to do is to dynamically change the positioning value.
2. Form verification: The form is the part you need to fill in when registering and logging in to your account. It is called a form. For example, when registering, if the password entered twice is inconsistent, a red prompt message will appear immediately. This is the effect created by js.
#3. Pop-up boxes on the page: For example, the warnings and prompt messages that pop up on the page are all made by js.
4. Multi-level tabs: Like Taobao's product categories, a category will appear when the mouse is placed on it, and a category can be divided from this category. These are also done by js.
There are many other effects created by js, such as animations on web pages, floating advertisements, shaking pictures, etc. I won’t list them all here. If you learn js, you can easily create these effects.
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What special effects can JavaScript do?. For more information, please follow other related articles on the PHP Chinese website!