Skip to content

Conversation

@olgakuzminagithub
Copy link
Collaborator

…emaking 18

* background-color
* */

/* Не получилось */
Copy link
Member

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')
Copy link
Member

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);
Copy link
Member

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')) {
Copy link
Member

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')
Copy link
Member

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) {
Copy link
Member

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

@OlegLustenko
Copy link
Member

Here several things to improve but I think it's ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants