I have been very interested in front-end development recently, especially with the help of popular ajax libraries such as jquery, it is indeed convenient to make good dynamic effects even if I do not have good javascript skills. But I don't think that's enough. After all, everything is encapsulated by others. You have to study native javascript in depth to be steadfast. Today, I saw a good blog and introduced an example of an album Based on Javascript dom programming. Although this example is very small, I personally think it is of great learning value. First, I will give html and, this will help you understand the JavaScript code later.
The Code is as follows:
Snapshots
The structure is quite simple. Here, the href attribute value of element a is the path of the big image to be displayed, and the img is the corresponding small image. The effect is to click the small image below, and the corresponding big image is displayed above.
The js implementation is given below:
The Code is as follows: