';
}
};
TabCollapse.prototype.checkState = function(){
if (this.$tabs.is(':visible') && this._accordionVisible){
this.showTabs();
this._accordionVisible = false;
} else if (this.$accordion.is(':visible') && !this._accordionVisible){
this.showAccordion();
this._accordionVisible = true;
}
};
TabCollapse.prototype.showTabs = function(){
this.$tabs.trigger($.Event('show-tabs.bs.tabcollapse'));
var $panelBodies = this.$accordion.find('.js-tabcollapse-panel-body');
$panelBodies.each(function(){
var $panelBody = $(this),
$tabPane = $panelBody.data('bs.tabcollapse.tabpane');
$tabPane.append($panelBody.children('*').detach());
});
this.$accordion.html('');
this.$tabs.trigger($.Event('shown-tabs.bs.tabcollapse'));
};
TabCollapse.prototype.showAccordion = function(){
this.$tabs.trigger($.Event('show-accordion.bs.tabcollapse'));
var $headings = this.$tabs.find('li:not(.dropdown) [data-toggle="tab"], li:not(.dropdown) [data-toggle="pill"]'),
view = this;
$headings.each(function(){
var $heading = $(this);
view.$accordion.append(view._createAccordionGroup(view.$accordion.attr('id'), $heading));
});
this.$tabs.trigger($.Event('shown-accordion.bs.tabcollapse'));
};
TabCollapse.prototype._checkStateOnResize = function(){
var view = this;
$(window).resize(function(){
clearTimeout(view._resizeTimeout);
view._resizeTimeout = setTimeout(function(){
view.checkState();
}, 100);
})
};
TabCollapse.prototype._initAccordion = function(){
this.$accordion = $('
');
this.$tabs.after(this.$accordion);
this.$tabs.addClass(this.options.tabsClass);
this.$tabs.siblings('.tab-content').addClass(this.options.tabsClass);
};
TabCollapse.prototype._createAccordionGroup = function(parentId, $heading){
var tabSelector = $heading.attr('data-target'),
active = $heading.parent().is('.active');
if (!tabSelector) {
tabSelector = $heading.attr('href');
tabSelector = tabSelector && tabSelector.replace(/.*(?=#[^\s]*$)/, ''); //strip for ie7
}
var $tabPane = $(tabSelector),
groupClass = $tabPane.attr('id'),
groupId = groupClass + '-collapse',
$panel = $(this.options.accordionTemplate($heading.html(), groupId, groupClass, parentId, active));
$panel.find('.panel-body').append($tabPane.children('*').detach())
.data('bs.tabcollapse.tabpane', $tabPane);
return $panel;
};
// TABCOLLAPSE PLUGIN DEFINITION
// =======================
$.fn.tabCollapse = function (option) {
return this.each(function () {
var $this = $(this);
var data = $this.data('bs.tabcollapse');
var options = $.extend({}, TabCollapse.DEFAULTS, $this.data(), typeof option == 'object' && option);
if (!data) $this.data('bs.tabcollapse', new TabCollapse(this, options));
})
};
$.fn.tabCollapse.Constructor = TabCollapse;
}(window.jQuery);
// Init tabCollapse
jQuery('#tabs').tabCollapse();
// Init Slider
jQuery('.slider').slick({
autoplay: true,
autoplaySpeed: 4000,
infinite: false,
arrows: false,
dots: true,
pauseOnHover: true
});
$(function () {
var activeTab = $('[href=' + location.hash + ']');
activeTab && activeTab.tab('show');
});