Home  >  Article  >  Web Front-end  >  A practical focus map switching effect encapsulated by javascript_javascript skills

A practical focus map switching effect encapsulated by javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:23:061103browse

So I changed it on the original basis, encapsulated it, and made further optimizations, so that the same page can use multiple such effects. There is no change in xhtm and css. Interested friends can follow it on js Compare the previous code to make it easier to understand and master.
If you have any questions or suggestions, please reply@&@
1.xhtml

Copy code The code is as follows:



   Picture one
                                                                                                                                                                                                                                                                              ;/a>
                                                                                             li class="on">1
                                                                                                                                                                                  🎜>




2.css




Copy code
The code is as follows:



Copy code
The code is as follows:function setBg(value){for(var i=0;ifunction plays(value ){
if(document.all) $(focbox).filters[0].Apply();//Filter
for(i=0;iif(document.all) $(focbox).filters[0].play( );
}
function mouse(n){//Set events after the mouse passes and leaves;
for(var i=0;i (function (n){
Num[i].onmouseover=imglist[i].onmouseover=function(){clearInterval(autoStart);Mea(n);}
Num[i].onmouseout=imglist[i] .onmouseout=function(){setAuto();}
            })(i); );plays(value);}
function auto(){n ;if(n>Num.length-1)n=0; Mea(n);}
function setAuto(){autoStart=setInterval( function(){auto();},time)}
setAuto();
}


Call the function after xhtml and pass in the object parameters:

Full demo code:

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