[CSS3] uses JAVASCript to trigger the transition effect. css3javascript
Using Pseudo classes such as hover and: focus, we can easily switch elements from one style to another, and switching will have a transitional effect. But sometimes we want to use js to drive the transition (that is, to trigger the transition in code. Like normal transition, create two style rules first. One is the initial state of the element, and the other is the state of transition. Then, use js to modify the style of the corresponding element on the appropriate server.
The following is an example of switching between the daily and night scenes: (1) the two pictures are stacked together. The initial transparency of the night view is 0, which is covered above the day view. (2) Click the "view night view" button. The transparency of the night view gradually changes from 0 to 1, and the screen gradually changes to the night view. (3) Click the "view the Sun Scene" button. The transparency of the night scene gradually changes from 1 to 0, and the screen looks like a day scene.
The online sample is as follows: <! Doctype html>
Original article: