var Call=document.getElementsByClassName("Call");
var li=document.getElementsByClassName("foot-11");
初始的图片路径
var arr=["images/底部11.png","images/底部2.png","images/底部3.png","images/底部4.png","images/底部5.png"]
切换的图片路径
var arr1=["images/底部1.png","images/底部22.png","images/底部33.png","images/shoushi.png","images/底部55.png"]
var x=0;
Call[x].style.backgroundColor="white";
for(var i=0;i<li.length;i++){
li[i].index=i;
监听点击事件
li[i].addEventListener("click",function(){
console.log(li[i])
Call[x].style.backgroundColor="#f13c18";
Call[x].children[0].src=arr[x]
x=this.index;
Call[x].style.backgroundColor="white";
Call[x].children[0].src=arr1[x]
})
}
网友评论