midzer/tobii

animation issue

viliusle opened this issue · 5 comments

Animation on second and third gallery items works only if you wait before opening second slide. If you open gallery and try to load next and next and next item fast, there will be no animation, but it will appear for other items.

I can reproduce this issue.

Gonna investigate when I have more time.

I believe I found it:
https://github.com/midzer/tobii/blob/production/src/js/index.js#L732

p.s. as always, fixing something with timeout will only give you troubles in future.

Updated relevant line:

setTimeout(() => {

Would it be enough to put

groups[activeGroup].slider.classList.add('tobii__slider--animate')

just after next() or previous() is called?

I am thinking about remove timout and leave code in same place. I don't see any issues during testing even after changing transform duration to 5s.

Thanks for your effort.

Now, I will test development branch on one of my live sites.