ν΄λ¦μ λμ΄μ λμ λ λͺ κ°μ§ λ¬Έμ κ° μμ΅λλ€. "Issue #54 - μμ : λμ΄μ λκΈ° μ§ν ν΄λ¦ μ ν λ°©μ§"μ λ°λ₯΄λ©΄ μ΄λ²€νΈκ° μ νλ₯Ό μ€μ§νμ§ μλ κ² κ°μ΅λλ€.
2.0.0-beta.3μμ μ¬μμ°ν μ μμ΅λλ€. μ¬ν λ¨κ³λ₯Ό μλ €μ£Όμ€ μ μλμ?
μλ
! λλ΅ ν΄μ€μ κ³ λ§μμ. "div" μμλ₯Ό μ€ν¬λ‘€νλ €κ³ νλλ° μ΄κ²μ΄ μ¬λ°λ₯Έ λ°©λ²μ΄ μλ μλ μμ΅λλ€.
μ½λλ λ€μκ³Ό κ°μ΅λλ€.
<drag-scroll class="drag-scroll center" #dragScroll scrollbar-hidden='true' drag-scroll-y-disabled='true' snap-disabled='true'>
<div drag-scroll-item *ngFor="let ah of article_list">
<col-article [article]="ah"></col-article >
</div>
</drag-scroll>
μ΄λ―Έμ§λ₯Ό ν΄λ¦νκ³ λλκ·ΈνκΈ°λ§ νλ©΄ λμ§λ§ μ΄λ―Έμ§λ₯Ό λμΌλ©΄ μ΄λ―Έμ§ λ§ν¬λ‘ 리λλ μ λ©λλ€. "dragend" μ΄λ²€νΈλ₯Ό μΆκ°ν μ μλ λ λ€λ₯Έ κ°λ₯μ±μ΄ μμ΅λκΉ?
κ°λ¨ν μ΄λ―Έμ§μ "divs" μμμμ μ€ν¬λ‘€νλ λ° μ°¨μ΄κ° μμ΅λκΉ? λλ¨Έμ§ λͺ¨λμ μ λλ‘ μλνκ³ μμΌλ©° μ λ§ μνκ³ μμ΅λλ€.
λ°λͺ¨μμ λ¬Έμ λ₯Ό μ¬ννλ €κ³ μλνλλ° λλκ·Έ νλͺ©μ΄ λ§ν¬μΌ λ λ°μν©λλ€. μλ₯Ό λ€μ΄ λ°λͺ¨μμ μ΄λ―Έμ§λ₯Ό λ³κ²½νλ κ²½μ°
<img _ngcontent-c6="" src="assets/img/c3po.png">
μκ²
<a href="http://anyurl.com"><img _ngcontent-c6="" src="assets/img/c3po.png"></a>
λ΄ νλ‘μ νΈμ λμΌν λμμ ν©λλ€.
λμμ΄ λμκΈ°λ₯Ό λ°λλλ€.
μ΄ λ¬Έμ λ₯Ό νΌνκΈ° μν΄ μ½λμμ μ½κ°μ μ²λ¦¬λ₯Ό ꡬννμ΅λλ€.
HTML:
`
<div dragScroll (reachesLeftBound)="leftBoundStat($event)" (reachesRightBound)="rightBoundStat($event)" #nav >
<div class=" slide-mes" *ngFor="let item of items " (click)="doAny(item)" >
</div>
</div>
`
νμ΄νμ€ν¬λ¦½νΈ:
`
@ViewChild('nav', {read: DragScrollDirective}) ds: DragScrollDirective;
clickEnable = true;
constructor( ) {
}
@HostListener('mousedown', ['$event'])
onMousedown(event) {
this.clickEnable = true
}
leftBoundStat(reachesLeftBound: boolean) {
this.leftNavDisabled = reachesLeftBound;
this.clickEnable = false;
}
rightBoundStat(reachesRightBound: boolean) {
this.rightNavDisabled = reachesRightBound;
this.clickEnable = false;
}
doAny(item){
if(this.clickEnable){
//do what you whant on click here
}
}
`
μλ νμΈμ κΈΈμλ₯΄λ©μ λλ€! λ΅λ³ κ°μ¬ν©λλ€! νκ³μ λλ¬νμ§ λͺ»νμ λ μλν©λκΉ? λ΄ κ΅¬νμμ μ€ν¬λ‘€ν iitemsκ° λ§κ³ μλ₯Ό λ€μ΄ κ²½κ³κ° μλ μ€κ°μμ ν΄λ¦μ λμΌλ©΄ μ΄μ¨λ μ νλκ³ κ²½κ³ μ΄λ²€νΈλ κ·Έ μ€ νλμ λλ¬ν λλ§ μμ±λκΈ° λλ¬Έμ λλ€( μΌμͺ½ λλ μ€λ₯Έμͺ½).
bounds μ΄λ²€νΈλ divλ₯Ό μ€ν¬λ‘€ν λ μμ±λλ©° μ¬κΈ°μ console.logλ₯Ό λ£μ΄ νμΈν©λλ€.
κ°μ¬ν©λλ€! ν¨κ³Όκ° μμλ€! κ·Έλ¬λ λ§μ°μ€ μ΄λ²€νΈλ μμ νλλ‘ λͺ¨λ μμ κ΅¬μ± μμλ₯Ό μ‘°μ ν΄μΌ νμ΅λλ€. κ·Έλμ λͺ¨λ μ체μμ ν΄λΉ κΈ°λ₯μ μμ²νμ΅λλ€.
μλ νμΈμ @leogilardi6λ , λ΅λ³μ΄ λ¦μ΄ μ£μ‘ν©λλ€. λλ μΌμ ν©μΈμλ€.
https://github.com/bfwg/ngx-drag-scroll/blob/develop/demo/app/home/home.component.html#L4 -L12λ₯Ό λ³κ²½νμ¬ μλνμ΅λλ€.
<drag-scroll class="demo-one"
drag-scroll-y-disabled="true"
scrollbar-hidden="true"
(reachesLeftBound)="leftBoundStat($event)"
(reachesRightBound)="rightBoundStat($event)"
#nav
>
<a drag-scroll-item *ngFor="let image of imagelist" href="https://www.google.com"><img [src]="'assets/img/' + image" (click)="clickItem(image)"/></a>
</drag-scroll>
νμ§λ§ λ²μ 2.0.0-beta.3μμλ μ¬νν μ μμ μ΅λλ€.
μ΅μ λ²μ μΌλ‘ νλ μ΄ν΄ λ³΄μ ¨λμ?