Home  >  Article  >  Web Front-end  >  JavaScript image fade effect code_image special effects

JavaScript image fade effect code_image special effects

WBOY
WBOYOriginal
2016-05-16 19:04:22821browse

Insert the following JAVASCRIPT code between and :


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

*where onMouseOver=nereidFade( style="FILTER: alpha(opacity=50)" in this,50,10,4) means that the transparency of the image is 50% <script> nereidFadeObjects = new Object(); nereidFadeTimers = new Object(); function nereidFade(object, destOp, rate, delta){ if (!document.all) return if (object != "[object]"){ setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0); return; } clearTimeout(nereidFadeTimers[object.sourceIndex]); diff = destOp-object.filters.alpha.opacity; direction = 1; if (object.filters.alpha.opacity > destOp){ direction = -1; } delta=Math.min(direction*diff,delta); object.filters.alpha.opacity+=direction*delta; if (object.filters.alpha.opacity != destOp){ nereidFadeObjects[object.sourceIndex]=object; nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); } } </script>
Statement:
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