
//# sourceMappingURL=maps/swiper.jquery.min.js.map

/**
 * 滑动切换面板主体
 * Created by kiner on 16/9/22.
 */
;(function($){

    $.fn.extend({
        "manySwipers": function(options) {
            var opts = $.extend({},defaults,options);
            return this.each(function(n){
                // var index = 0;
                var $this = $(this);
                var nav = $this.find(opts.navSelector),
                    con = $this.find(opts.conSelector);
                var returnObj = {
                    slideTo: function (index) {
                        selectPanel(index, 2);
                    },
                    on: function (name, handler) {
                        handlers[name] = handler;
                    },
                    handlerNameList: {
                        "change": "change"
                    }
                };
                var handlers = {
                };
                con.addClass('swiper-container').find('.wrapper').addClass('swiper-wrapper').end().find('.kinerItem').addClass('swiper-slide');
                var len = nav.find('item').length;
                nav.find("realBorder").css({
                    width: (1/len)*100+"%"
                });
                var mySwiper = new Swiper(opts.conSelector+'.swiper-container', {
                    direction: 'horizontal',
                    observer: true,
                    observeParents: true,
                    autoHeight: true, //高度随内容变化
                    onTransitionEnd: function (swiper) {
                        var len = nav.find('item').length;
                        var index = swiper.activeIndex;
                        nav.find("item").removeClass('active').eq(index).addClass('active');
                        nav.find("realBorder").css({
                            left: index == 0 ? 0 : Math.floor((index / len)* 100)  + "%"
                        });
                    }
                });
                nav.on('click','item',function(e){
                    var onActive = $(this).index()-1;
                    if (n > 0) {
                         console.log(onActive)
                        mySwiper[n].slideTo(onActive);
                    } else {
                         console.log(onActive)
                        mySwiper.slideTo(onActive);
                    }
                });
            });
        }
    });
    var defaults = {
            navSelector: "kinerNav",//导航栏选择器
            conSelector: "kinerContent"//显示面板选择器
        }
})(window.jQuery);

