Search code examples
jssor

JSSOR - Is it possible to fade in/out bullets/thumbnails when sliding?


Like the title says is it possible to fade out bullets or thumbnails when starting to slide and fade in when its stopping with the slide animation? I looked into the development section but can't seem to find anything about it.

At the moment I just always show the thumbnails but it looks weird when the sliding animation is running. It would be great if there's a way to do this without to much custom code.


Solution

  • Given you have a bullet navigator element as follows,

    <div u="navigator" class="jssorb03" ...>
    ...
    </div>
    

    You can make it fade out while swipe start, and fade in while swipe end.

    function SwipeStartEventHandler(position) {
        if(Math.floor(position) == position)
            $(".jssorb03").fadeOut();
    }
    
    function SwipeEndEventHandler(position) {
        if(Math.floor(position) == position)
            $(".jssorb03").fadeIn();
    }
    
    jssor_slider1.$On($JssorSlider$.$EVT_SWIPE_START, SwipeStartEventHandler);
    jssor_slider1.$On($JssorSlider$.$EVT_SWIPE_END, SwipeEndEventHandler);