top-slider.js 795 Bytes
var $ = require('yoho-jquery');

require('yoho-slider');

$(function() {
    var topSlider = $('.slide-container').unslider({
        autoplay: true,
        delay: 5000,
        arrows: {

            // TODO: 手动点击 未完成
        },
        nav: false,
        animate: 'fade',
        pagination: '.thumb-pagination'
    });

    var $thumbPagination = $('.thumb-pagination');

    $thumbPagination.on('mouseenter', 'li', function() {
        var $this = $(this);

        topSlider.unslider('animate:' + $this.data('slide'));
    });

    topSlider.on('unslider.change', function(event, index) {
        $thumbPagination.find('[data-slide="' + index + '"]').addClass('focus').siblings().removeClass('focus');
    });

    $thumbPagination.find('li').first().addClass('focus');
});