- fix when infinite element not exist problem:fix when infinite element not init, clear cause carousel break problem.
- fix infinite loop problem with rxjs:fix infinite loop problem with rxjs.
- show-number auto with breakpoint problem: fix problem with breakpoint.
- fix infinite loop problem with rxjs:fix infinite loop problem with rxjs.
- Change animation way with
transform
: usingtransform: translateX()
to change left position.
-
Fix rounding error when calculating element width: using
getBoundingClientRect()
to get init view width to avoid carousel display improperly, thanks for anteq in requests 17 -
Prevent Drag click event trigger: when hammer stop the click event will occur, fix that with document
touchend
andmouseup
-
Drag Boundary Problem: caculate with left by touch boundary, caculate the swipe index.
- Infinite mode or autoplay mode: We need add
<ng-template #infiniteContainer></ng-template>
and#carouselContent
in the template, and add[data]="avatars"
in thengx-hm-carousel
, to make the template in the angular life cycle, the example is below.
<section ngx-hm-carousel-container class="content">
<article class="item cursor-pointer"
ngx-hm-carousel-item
*ngFor="let avatar of avatars; let i = index"
[ngClass]="{'visible': currentIndex===i}">
<div class="img" (click)="click(i)"
[style.backgroundImage]="'url('+avatar.url+')'">
{{i}}
</div>
</article>
<ng-template #infiniteContainer></ng-template>
</section>
<ng-template #carouselContent let-avatar let-i="index">
<article class="item cursor-pointer"
[ngClass]="{'visible': currentIndex===i}">
<div class="img" (click)="click(i)"
[style.backgroundImage]="'url('+avatar.url+')'">
{{i}}
</div>
</article>
</ng-template>
- Seprate moving animation with user occur and autoplay: We seprate the animation class with
[aniClass]
and[aniClassAuto]
, now we can use different class for that.
Example
- Mouse over restart problem: Fix error with
[mourse-enable]=true
problem with restart.
- Break point with width: We can set own break point with input
[breakpoint]
to switch show number with own logic. Example Important: the breakpoint is follow thecontainer width
, not follow with window width.
// the breakpoint interface
export interface NgxHmCarouselBreakPointUp {
width: number;
number: number;
}
- infinite with multi show number: We can use the input
[show-num]
and set[infinite]="true"
, it will clone the element to view, and can change the input dynamicly to switch show number. Example
-
Mouse over restart problem: Fix when enable
mourse-enable
, when mourse on the carousel and drap the view, change index, the restart will run problem. -
Drag many animation disappear problem: Fil problem with drag many, the animation doesn't append problem.
- Fix Animation error: fix doesn't remove aniClass when remove animation.
- Fix init with index error: fix when init with index, the animation will occur problem.
- Add support with Angular Universal: when universal run, it will init with carousel view.
- Add Disable Drag: add input to switch drag event listener with [disable-drag].
- When elements length zero can't drag: Now when children elements length is equal zero, stop drag event.
- Not drag with pan move: change name with [notDrag] to [not-follow-pan].
- Optimize Performance: fix problem with change Detection by onPush and ngZone
- remove emit with progress width: remove emit with progress width, it will cause performance problem, now it only using width change with progress bar, change like below.
<ng-template #carouselProgress let-progress>
<div class="progress"></div>
</ng-template>
.progress {
position: absolute;
bottom: 0;
left: 0;
width: 0; // set default width to zero, it will increase with duraction (%)
height: 5px;
background: #ff5252;
}
- Animation class: add [input] with animation add class by [aniClass]
- Not drag with pan move: add [input] with Not drag with pan move by [notDrag]
- Mobile touch error: Fix when scroll event occur, the carousel will move error point, and can't touch problem.
- carousel item change: When add item to the children, will recaculate the carousel variable.
- Add ngx-hm-carousel-item directive back: with recaculate the carousel varibae so add
ngx-hm-carousel
back.
- Fix infinite problem with next and prev click: fix error with infinite .
- Fix mask not clear problem: when drag occur, we use an mask to avoid click event emit, but it will not clear when drag end, add pancancel to fix that.
-
When item is smaller than length the mask non remove: fix bug when show number is more than item langth, mask click don't remove.
-
Mask bug fix: Fix mask bug with grab.
- Remove ngx-hm-carousel-item: remove item directive in the container, just the first child of container is the item, and we can use nomal click event in the content.
- Speed Change Dynamically: Now you can change input[autoplay-speed] to change speed dynamically.
- align center: when align set to 'center', always can drag move.
- auto play: infinite always changed with autoplay.
- ng build --prod: fix problem with ng build --prod.
- Dynamic Directive:
ngxHmCarouselDynamic
can load item Dynmain. - infinite option: Now, you can set infinite to true, make this carousel loop change.
- ControlValueAccessor: You can use ngModel with
ngx-hm-carousel
, more easy to use with index.
- current-index:
current-index
is removed, replace withngModel
. - index-change:
index-change
is removed, replace withngModel
.
- Scroll right change: Scroll right upto length-showNum.
- Add Dynmain load element: Add Dynmain load element with ngxHmCarouselDynamic directive.
<ngx-hm-carousel
[current-index]="currentI"
[infinite]="true"
[align]="left"
class="carousel c-accent"
(index-change)="currentI = $event">
<!-- style="height: calc(100vh - 50px);" -->
<section ngx-hm-carousel-container class="content">
<article class="item cursor-pointer"
*ngFor="let item of data; let i = index"
ngx-hm-carousel-item>
<div *ngxHmCarouselDynamic="i; length: data.length; index: currentI"
class="img" [style.backgroundImage]="item.url">
</div>
</article>
</section>
</ngx-hm-carousel>
- fix bug with showNum: forget the get method of showNum, repair it.
- use resize-observer-polyfill to handle element resize: use resize-observer-polyfill handle container resize
- set index response: when set same current Index not response
- when show number is zero error: when show number is zero, alignDistance always be zero
- click event position error : fix when container has some padding or margin, the click event will give error index.
- align mode : add align mode with
[align]
'left' | 'center' | 'right'
, default is center.
- when index change restart autoplay time
- fix autoplay cancel bug
- An carousel for Angular support mobiel with Hammerjs