[CSS3] uses JAVASCript to trigger the transition effect. css3javascript

Source: Internet
Author: User

[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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.