2017-10-24 5 views
0

Zepto를 사용하여 내 사이트에서 Siema carousel을 사용하고 있습니다. 사용자가 현재 어떤 슬라이드를 사용하고 있는지 알려주고 싶습니다. onChange 이벤트 만 사용할 수 있으면 어떻게해야합니까?Siema Ca 표시

HTML

<section class="images"> 
    <img/> 
    <img/> 
</section> 

<section class="indicators"> 
    <span class="active"></span> 
    <span></span> 
</section> 

JS

$(document).ready(function() { 
    new Siema({ 
    selector: '.images', 
    onChange:() => { 
     console.log("swiped"); 
     // change active indicator? 
    }, 
    }); 
}); 
+0

보라. 이것은 당신이 찾고있는 행동의 예가 있어야합니다. – Joffutt4

답변

0

나는 (내가 Siema의 저자 해요) 도울 수 있다고 생각합니다.

https://codepen.io/pawelgrzybek/pen/boQQWy

// extend a Siema class and add addDots() & updateDots() methods 
const mySiemaWithDots = new SiemaWithDots({ 

    // on init trigger method created above 
    onInit: function(){ 
    this.addDots(); 
    this.updateDots(); 
    }, 

    // on change trigger method created above 
    onChange: function(){ 
    this.updateDots() 
    }, 

}); 

사랑스러운 일을 현재 슬라이드에 대한 [Siema 회전 목마] (https://github.com/pawelgrzybek/siema)의 API 섹션에서