+Стрелочные функции!

This commit is contained in:
2020-11-12 17:09:03 +06:00
parent 046d957b7d
commit 27d49bf102
8 changed files with 32 additions and 63 deletions

View File

@ -7,10 +7,9 @@ function TCGallery(parent)
if(this.mas[0].style.opacity > 0.05)
{
this.mas[0].style.opacity = this.mas[0].style.opacity - 0.05;
this.timeout_id=setTimeout(function(thiz){return function(){thiz.work();}}(this),50);
this.timeout_id=setTimeout(()=>this.work(),50);
this.test++;
//console.info(this.test+' 50 '+this.mas[0].style.opacity);
}else
{
//Перестовляем Z индексы первый на последнее место (больший наверху)
@ -29,12 +28,9 @@ function TCGallery(parent)
{ this.mas[i].style.opacity = 1;
}
this.mas.sort(function(a,b){return b.style.zIndex-a.style.zIndex;}); //Сортируем с макс Z индексом наверху в 0ле
this.timeout_id=setTimeout(function(thiz){return function(){thiz.work();}}(this),5000); //Перезапускаем таймер через 10 секунд с максимальным Z индексом
this.timeout_id=setTimeout(()=>this.work(),5000); //Перезапускаем таймер через 10 секунд с максимальным Z индексом
this.selected();
this.test++;
//console.info(this.test+' 5000 '+this.mas[0].style.opacity);
}
};
//Стартуем галерею
@ -46,7 +42,7 @@ function TCGallery(parent)
if(maxz<this.mas[i].style.zIndex) maxz=this.mas[i].style.zIndex;
}
if(this.mas.length>0)
setTimeout(function(thiz){return function(){thiz.work();}}(this),5000);
setTimeout(()=>this.work(),5000);
maxz++;
//Кнопочки для переключения картинок
@ -87,7 +83,7 @@ function TCGallery(parent)
}
clearTimeout(this.timeout_id)
this.timeout_id=setTimeout(function(thiz){return function(){thiz.work();}}(this),10000);
this.timeout_id=setTimeout(()=>this.work(),10000);
this.selected();
};
//Поменялся элемент
@ -225,7 +221,7 @@ class TCGallery2
if(dx>0) dx=Math.ceil(dx); else dx=Math.floor(dx);
this.parent.scrollLeft+=dx;
if(this.parent.scrollLeft!=this.pos)
setTimeout(function(thiz){ return function(){ thiz.moveTo(); } }(this),10);
setTimeout(()=>this.moveTo(),10);
}
}