Home  >  Article  >  Web Front-end  >  How to achieve the gradient switching effect of images from left to right in js_javascript skills

How to achieve the gradient switching effect of images from left to right in js_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:15:151669browse

The example in this article describes how to use js to achieve the effect of gradient switching of images from left to right. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:




   
     
   
   
     

       

         
href="#" target=_blank>

        
       

        
       

       

     
     
         
           
         
           
         
         
           
         
     

  

     

  

  

<script><br> var n=0;<br> var showNum = document.getElementByIdx_x("num");<br> function Mea(value){<br>  n=value;<br>  setBg(value);<br>  plays(value);<br>  }<br> function setBg(value){<br>  for(var i=0;i<4;i )<br />    if(value==i){<br />   showNum.getElementsByTagName_r("td")[i].className='woon';<br />   }<br />  else{<br />   showNum.getElementsByTagName_r("td")[i].className='wooff';<br />   } <br />  }<br /> function plays(value){<br />  with (fc){<br />   filters[0].Apply();<br />   for(i=0;i<4;i )i==value?children[i].style.display="block":children[i].style.display="none";<br />   filters[0].play();  <br />   }<br /> }<br /> function clearAuto(){clearInterval(autoStart)}<br /> function setAuto(){autoStart=setInterval("auto(n)", 5000)}<br /> function auto(){<br />  n ;<br />  if(n>3)n=0;<br>  Mea(n);<br> }<br> function sub(){<br>  n--;<br>  if(n<0)n=3;<br>  Mea(n);<br> }<br> setAuto();<br> </script>


希望本文所述对大家的javascript程序设计有所帮助。

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