Javascript uniform motion to achieve fade-in and fade-out effect (code)

不言
Release: 2018-08-31 10:19:49
Original
1173 people have browsed it

The content of this article is about the fade-in and fade-out effect of JavaScript uniform motion (code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Principle

  • When doing p or picture fade-in and fade-out, we mainly use the transparency style filter: alpha(opacity:30) is compatible with ie, opacity:0.3 is compatible Firefox chrome.

  • When the motion fades in and out, the timer setInterval;clearInterval;

  • When js operates to fade in and out, use the following form to modify the transparency op.style. filter="alpha(opacity:" alpha ")";op.style.opacity=alpha/100;

Note: transparency cannot be judged directly in js, we use the alpha parameter Do the comparison and finally apply it to the object.

Realize div fade-in and fade-out

   div淡入淡出   
Copy after login

Realize image fade-in and fade-out

   图片淡入淡出   
Copy after login

Related recommendations:

javascript uniform motion to achieve sidebar sharing effect ( Code)

js to realize uniform fade-in and fade-out of images

Use jQuery to realize advertising scrolling and fade-in and fade-out

The above is the detailed content of Javascript uniform motion to achieve fade-in and fade-out effect (code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!