Gathering detailed insights and metrics for ngx-hm-carousel
Gathering detailed insights and metrics for ngx-hm-carousel
Gathering detailed insights and metrics for ngx-hm-carousel
Gathering detailed insights and metrics for ngx-hm-carousel
a light carousel for Angular18+, support mobile touch by hammerJs
npm install ngx-hm-carousel
Typescript
Module System
Node Version
NPM Version
TypeScript (93.13%)
HTML (3.63%)
SCSS (3.24%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
61 Stars
133 Commits
11 Forks
3 Watchers
2 Branches
3 Contributors
Updated on Jan 20, 2025
Latest Version
19.0.0
Package Id
ngx-hm-carousel@19.0.0
Unpacked Size
243.89 kB
Size
56.86 kB
File Count
15
NPM Version
10.9.0
Node Version
20.15.0
Published on
Jan 20, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
4
A lightweight carousel UI for Angular, support mobile touch with Hammerjs.
Work with custom animation, and server-side-rendering.
An Carousel that easy to use with your custom template.
This package is design by angular and hammerjs.
Depend on Hammerjs.
Support Angular 18+
please use v18.x.x
version, which follow the main version of Angular.
for version before v18, please use v3.0.0
, view more legacy version in legacy readme.
1npm install --save ngx-hm-carousel hammerjs
1import 'hammerjs'; 2 3import { provideExperimentalZonelessChangeDetection, model } from '@angular/core'; 4 5import { ChangeDetectionStrategy, Component } from '@angular/core'; 6import { bootstrapApplication } from '@angular/platform-browser'; 7import { NgxHmCarouselComponent, NgxHmCarouselDynamicDirective, NgxHmCarouselItemDirective } from './lib'; 8import { NgClass, NgFor } from '@angular/common'; 9import { FormsModule } from '@angular/forms'; 10 11@Component({ 12 selector: 'app-root', 13 standalone: true, 14 imports: [NgxHmCarouselComponent, NgxHmCarouselItemDirective, NgxHmCarouselDynamicDirective, NgClass, FormsModule, NgFor], 15 templateUrl: './app.component.html', 16 changeDetection: ChangeDetectionStrategy.OnPush, 17}) 18export class App { 19 currentIndex = model(0); 20 speed = 5000; 21 infinite = true; 22 direction = 'right'; 23 directionToggle = true; 24 autoplay = true; 25 avatars = '1234567891234'.split('').map((x, i) => { 26 const num = i; 27 // const num = Math.floor(Math.random() * 1000); 28 return { 29 url: `https://picsum.photos/600/400/?${num}`, 30 title: `${num}`, 31 }; 32 }); 33 34 click(i: number) { 35 console.log(`${i}`); 36 } 37} 38 39bootstrapApplication(App, { 40 providers: [provideExperimentalZonelessChangeDetection()], 41});
app.component.html
1<ngx-hm-carousel [(ngModel)]="currentIndex" [show-num]="4" [autoplay-speed]="speed" [infinite]="infinite" [drag-many]="true" [aniTime]="200" [data]="avatars" class="select-none"> 2 <section ngx-hm-carousel-container class="flex"> 3 <article class="transition-opacity duration-200 ease-linear py-2 px-1" ngx-hm-carousel-item *ngFor="let avatar of avatars; let i = index" [ngClass]="currentIndex() === i ? 'opacity-100' : 'opacity-50'"> 4 <div class="h-96 bg-cover bg-center cursor-pointer" (click)="click(i)" [style.backgroundImage]="'url(' + avatar.url + ')'">{{ i }}</div> 5 </article> 6 <ng-template #infiniteContainer></ng-template> 7 </section> 8 9 <!-- only using in infinite mode or autoplay mode, that will render with--> 10 <ng-template #carouselContent let-avatar let-i="index"> 11 <article class="transition-opacity duration-200 ease-linear py-2 px-1" [ngClass]="currentIndex() === i ? 'opacity-100' : 'opacity-50'"> 12 <div class="h-96 bg-cover bg-center cursor-pointer" (click)="click(i)" [style.backgroundImage]="'url(' + avatar.url + ')'">{{ i }}</div> 13 </article> 14 </ng-template> 15 16 <ng-template #carouselPrev> 17 <div class="w-[50px] text-center"> 18 <i class="material-icons text-3xl">keyboard_arrow_left</i> 19 </div> 20 </ng-template> 21 <ng-template #carouselNext> 22 <div class="w-[50px] text-center"> 23 <i class="material-icons text-3xl">keyboard_arrow_right</i> 24 </div> 25 </ng-template> 26 27 <ng-template #carouselDot let-model> 28 <div class="size-2.5 opacity-50 rounded-full border-2 border-solid bg-blue-600" [ngClass]="{ 'opacity-100': model.index === model.currentIndex }"></div> 29 </ng-template> 30 31 <ng-template #carouselProgress let-progress> 32 <div class="progress"></div> 33 </ng-template> 34</ngx-hm-carousel>
Attribute | Necessary | Default value | Type | Location | Description |
---|---|---|---|---|---|
autoplay | no | false | boolean | ngx-hm-carousel | carousel auto play confing |
autoplay-speed | no | 5000 (ms) | number | ngx-hm-carousel | auto play speed |
between-delay | no | 8000 (ms) | number | ngx-hm-carousel | each auto play between time |
autoplay-direction | no | 'right' | 'left' or 'right' | ngx-hm-carousel | auto play direction |
mouse-enable | no | false | boolean | ngx-hm-carousel | is mouse moveover stop the auto play |
autoplay | no | false | boolean | ngx-hm-carousel | carousel auto play config |
[breakpoint] | no | [] | NgxHmCarouselBreakPointUp | ngx-hm-carousel | switch show number with own logic like bootstrap scss media-breakpoint-up |
show-num | no | 1 | number or 'auto' | ngx-hm-carousel | how many number items to show once |
scroll-num | no | 1 | number | ngx-hm-carousel | how many number with each scroll |
drag-many | no | false | boolean | ngx-hm-carousel | is can scroll many item once, simulate with scrollbar |
swipe-velocity | no | 0.3 | number | ngx-hm-carousel | Minimal velocity required before recognizing, unit is in px per ms. |
pan-boundary | no | 0.15 | number of false | ngx-hm-carousel | user move picture with the container width rate, when more than that rate, it will go to next or prev, set false will never move with distance rate |
align | no | 'left' | 'left' or 'right' or 'center' | ngx-hm-carousel | when show-num is bigger than 1, the first item align |
infinite | no | false | boolean | ngx-hm-carousel | is the carousel will move loop |
data | no | undefined | any[] | ngx-hm-carousel | the data you using with *ngFor , it need when infinite mode or autoplay mode |
aniTime | no | 400 | number | ngx-hm-carousel | when infinite is true, the animation time with item |
aniClass | no | 'transition' | string | ngx-hm-carousel | this class will add when carousel touch drag or click change index |
aniClassAuto | no | 'aniClass' | string | ngx-hm-carousel | this class will add when carousel auto play |
disable-drag | no | false | boolean | ngx-hm-carousel | disable drag event with touch and mouse pan moving |
not-follow-pan | no | false | boolean | ngx-hm-carousel | disable when drag occur the child element will follow touch point. |
[(ngModel)] | no | 0 | number | ngx-hm-carousel | You can bind ngModel with this carousel, it will two way binding with current index. You also can use (ngModelChange)="change($event)" with that. |
1// the breakpoint interface 2export interface NgxHmCarouselBreakPointUp { 3 width: number; 4 number: number; 5}
normal click with effect the touch event, using this event replace that.
Attribute | Location | Description |
---|---|---|
ngxHmCarouselDynamic | any tag | It will dynamic load tag with element. |
This Directive will Dynamic load element with previous element and next element and current element.
1<section ngx-hm-carousel-container class="content"> 2 <article class="item cursor-pointer" ngx-hm-carousel-item *ngFor="let item of data; let i = index"> 3 <div *ngxHmCarouselDynamic="i; length: data.length; index: currentI" class="img" [style.backgroundImage]="item.url"></div> 4 </article> 5</section>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More