Y in front of the plug-in is based on my own plug-in encapsulation, which can be changed to var for execution. This plug-in is used for company websites. For your reference only. If you have better implementation methods or problems, please leave a message.
<div class="phone_av"></div>Y.setHightlight.set({ target:Y.$id("phone_av"), speed : 40, defaultColor : "#FFF4D9" });
// Highlight Y. setHightlight = (function () {var HeightLight = function (o) {this. setting = typeof o = 'object '? O: {}; this.tar get = this.setting.tar get | 'higint'; this. speed = this. setting. speed | 100; this. color = this. setting. defaultColor | "# ffffff"; this. varColor = true; this. colorFix = 17; this. colorMaxCount = 4; this. colorCount = 0; this. colorG = 0; this. colorB = 0; this. toRGB (); this. set ();} HeightLight. prototype = {set: function () {var me = this; var colorG = me. colorG; var colorB = me. colorB; var setBgColor = setInterval (function () {if (me. varColor) {colorG + = me. colorFix; colorB + = me. colorFix; if (colorG> = 255) {me. varColor = false; me. colorCount ++ ;}} else {colorG-= me. colorFix; colorB-= me. colorFix; if (colorG <= 170) {me. varColor = true; me. colorCount ++ ;}} if (me. colorCount> = me. colorMaxCount) {clearInterval (setBgColor); me.tar get. style. backgroundColor = "rgb (255,255,255)"; colorG = me. colorG; colorB = me. colorB;} me.tar get. style. backgroundColor = "rgb (255," + colorG + "," + colorB + ")" ;}, me. speed) ;}, toRGB: function () {var me = this; var reg =/^ # ([0-9a-fA-f] {3} | [0-9a-fA-f] {6}) $ /; var sColor = me. color. toLowerCase (); if (sColor & reg. test (sColor) {if (sColor. length = 4) {var sColorNew = "#"; for (var I = 1; I <4; I + = 1) {sColorNew + = sColor. slice (I, I + 1 ). concat (sColor. slice (I, I + 1);} sColor = sColorNew;} // process the six-digit color value var sColorChange = []; for (var I = 1; I <7; I + = 2) {sColorChange. push (parseInt ("0x" + sColor. slice (I, I + 2);} me. colorG = sColorChange [1]; me. colorB = sColorChange [2] ;}}return {set: function (o) {var SetBgColor = new HeightLight (o );}}})();