JS to achieve the same page multiple gradient effect method

Source: Internet
Author: User

Here you can implement any of the 5 elements, the mouse to move up the transparency gradually increased, the mouse moved out, transparency gradually reduced the effect.

Point one:

1 2 3 4 5 6 var speed = 0; if (target>obj.alpha) {speed = 5;} else{speed =-5;}

A positive or negative velocity is determined by comparing the target value with the current value.

Point two:

1 2 3 4 5 6 7 8 9 10 For (i=0 i<runs_li.length; i++) {runs_li[i].timer = null; runs_li[i].alpha = Runs_li[i].onmouseover = function () {s Tartrun (this,100); } runs_li[i].onmouseout = function () {startrun (this,30);}}

Each element is added with its own transparency value, and the respective transparency changes are separated.

Finally, on the code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 This is the same as the same as the other, at the same-------------------------- <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.