-
Notifications
You must be signed in to change notification settings - Fork 0
add 0 Task + carousel, confused in numbers and called a branch of hom… #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| * background-color | ||
| * */ | ||
|
|
||
| /* Не получилось */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а здесь дело в том, что получится только при помощи appendChild :)
| list[i].style.left = nextPosition + 'px'; | ||
| let position = parseInt(list[i].style.left); | ||
| if (position === 0) { | ||
| list[i].classList.add('active') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about toggle? :)
| } | ||
| start() { | ||
| /*Объявляем перменные */ | ||
| let carousel = document.querySelector(this.elementToApply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that method VERY BIG, can we split some logic to other methods?
| } | ||
| infinityCarousel () { | ||
| let last = this.list.length - 1; | ||
| if (!this.list[last].classList.contains('active')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there a bunch of calculations, want to think about it optimization a bit
| this.list[i].style.left = nextPosition + 'px'; | ||
| let position = parseInt(this.list[i].style.left); | ||
| if (position === 0) { | ||
| this.list[i].classList.add('active') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about method toggle ? do you remember any ?:)
| this.list[i].classList.remove('active') | ||
| } | ||
| } | ||
| } else if (this.list[last].classList.contains('active') && this.infinity === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.list[last].classList.contains('active') && this.infinity === true
well, having such conditionals is a tech-debt.
We can ask user for set default active element for example to avoid such construction or something else
|
Here several things to improve but I think it's ready to merge |
…emaking 18