/*
订单切换封装后 */
(function(){
var filter= document.querySelector('.filter').children;
var orderData =document.getElementsByClassName('orderData');
var ind_=0;
for(var i=0;i<filter.length;i++){
filter[i].setAttribute('index',i);
filter[i].onclick =function(){
ind_ =this.getAttribute('index');
for(var j =0;j<filter.length;j++){
filter[j].classList.remove('active');
filter[ind_].classList.add('active');
}
for(var k=0;k<orderData.length;k++){
orderData[k].classList.add('orderDataHidden');
orderData[ind_].classList.remove('orderDataHidden');
}
}
}
/* 自动切换 */
var timer;
function auto(){
timer =setInterval(function(){
ind_++;
ind_ = ind_>=filter.length ? 0: ind_;
filter[ind_].onclick();
},1000);
}
auto();
var order =document.getElementsByClassName('order')[0];
order.onmouseover = function(){
clearInterval(timer);
}
order.onmouseout =function(){
auto();
}
})();