Commit 726373b5 by abraham

slidechange

parent 04e55605
...@@ -27,8 +27,10 @@ export class CarouselComponent implements AfterViewInit { ...@@ -27,8 +27,10 @@ export class CarouselComponent implements AfterViewInit {
next() { next() {
if (this.currentSlide + 1 === this.items.length) return; if (this.currentSlide + 1 === this.items.length) return;
console.log(this.items);
console.log(this.itemWidth);
this.currentSlide = (this.currentSlide + 1) % this.items.length; this.currentSlide = (this.currentSlide + 1) % this.items.length;
const offset = this.currentSlide * this.itemWidth; const offset = this.currentSlide * 404;
const myAnimation: AnimationFactory = this.buildAnimation(offset); const myAnimation: AnimationFactory = this.buildAnimation(offset);
this.player = myAnimation.create(this.carousel.nativeElement); this.player = myAnimation.create(this.carousel.nativeElement);
this.player.play(); this.player.play();
......
<section class="carousel-wrapper" [ngStyle]="carouselWrapperStyle"> <section class="carousel-wrapper" [ngStyle]="carouselWrapperStyle">
<ul class="carousel-inner" #carousel> <ul class="carousel-inner" #carousel>
<li *ngFor="let item of items;" class="carousel-item"> <li *ngFor="let item of items;" class="carousel-item" >
<ng-container [ngTemplateOutlet]="item.tpl"></ng-container> <ng-container [ngTemplateOutlet]="item.tpl"></ng-container>
</li> </li>
</ul> </ul>
</section> </section>
......
...@@ -7,4 +7,12 @@ ...@@ -7,4 +7,12 @@
width: auto; width: auto;
} }
} }
}
.carousel-inner {
display: flex;
width: max-content;
.carousel-item{
width: 404px !important;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment