其他分享
首页 > 其他分享> > sdsdsdsdsdsdsdsdsd

sdsdsdsdsdsdsdsdsd

作者:互联网

var lbt = document.getElementsByClassName('lbt')[0];
var nav = document.getElementsByTagName('span');
index = 0;
 //指示符
 for (i = 0; i < nav.length; i++) {
     nav[i].index = i;
     nav[i].onclick = function() {
     index=this.index;
     console.log(this.index);
     lbt.style.marginLeft = this.index * -400 + 'px';
     for (q = 0; q < nav.length; q++) {
       nav[q].className = '';
       }
     nav[this.index].className = 'span-hover';
     // console.log(i);
            }
     }

标签:index,span,log,sdsdsdsdsdsdsdsdsd,nav,var,lbt
来源: https://www.cnblogs.com/A9s2c/p/16376804.html