<! DOCTYPE html>
<meta charset= "Utf-8" >
<TITLE>JAVASCRIPT+CSS3 Simple Accordion Effect </title>
<style>
#imageMenu {Width:500px;height:200px;overflow:hidden;}
#imageMenu ul *{transition:all linear 0.2s;}
#imageMenu ul{width:800px;height:200px;padding:0; margin:0; List-style:none}
#imageMenu Li{float:left;}
#imageMenu ul Li A{width:73px;height:110px;overflow:hidden;}
#imageMenu ul big a {width:200px;}
#imageMenu Li a{width:98px;height:200px;display:block;text-indent:9999px;border-right:2px solid #fff; cursor: Pointer;overflow:hidden;}
#imageMenu. Landscapes A{background:url (http://img.funshion.com/pictures/media/list/109/251/109251_200_110.jpg? 1405409131) No-repeat;}
#imageMenu. People A{background:url (http://img.funshion.com/pictures/media/list/109/562/109562_200_110.jpg? 1386039195) No-repeat;}
#imageMenu. Nature A{background:url (http://img.funshion.com/pictures/media/list/101/158/101158_200_110.jpg? 1405677722) No-repeat;}
#imageMenu. Urban A{background:url (http://img.funshion.com/pictures/media/list/103/960/103960_200_110.jpg? 1395209765) No-repeat;}
#imageMenu. Abstract A{background:url (http://img.funshion.com/pictures/media/list/106/935/106935_200_280.jpg? 1405186860) No-repeat;}
</style>
<body>
<div id= "ImageMenu" >
<ul>
<li class= "Landscapes" >
<a href= "#link1" >Landscapes</a>
</li>
<li class= "People big" >
<a href= "#link1" >People</a>
</li>
<li class= "Nature" >
<a href= "#link1" >Nature</a>
</li>
<li class= "Urban" >
<a href= "#link1" >Urban</a>
</li>
<li class= "abstract" >
<a href= "#link1" >Abstract</a>
</li>
</ul>
</div>
<script type= "Text/javascript" >
function bind (Ele, Evtype, callback) {
if (typeof Ele.addeventlistener = = = ' function ') {
Ele.addeventlistener (Evtype, callback, false);
}else if (typeof ele.attechevent = = = ' function ') {
Ele.attechevent (' On ' +evtype, callback);
}
}
function Mouseoverhander (EV, lists) {
var imagemenu = document.getElementById (' ImageMenu ');
var lists = imagemenu.getelementsbytagname (' li ');
Lists = Lists | | [];
var target = Ev.target | | Ev.srcelement;
for (var i = 0; i < lists.length; i++) {
Simple regular expressions have ' big ' (here match space and big) This class is replaced by "
Lists[i].classname = Lists[i].classname.replace (/? big/g, ");
}
If the current element is not Li looking for his parent node, when bubbling to the body, exit
while (Target.tagName.toLowerCase ()! = ' Li ' && target.tagName.toLowerCase ()! = ' body ') {
target = Target.parentnode;
}
Target.classname + = ' big ';
}
Window.onload = function () {
var imagemenu = document.getElementById (' ImageMenu ');
var lists = imagemenu.getelementsbytagname (' li ');
for (var i = 0, L = lists.length; i < L; i++) {
Bind (Lists[i], ' mouseover ', function (e) {
Mouseoverhander (E, lists);
});
}
}
</script>
</body>
JAVASCRIPT+CSS3 Simple Accordion effect