2015-10-20 16:40:56 +00:00
|
|
|
(function (window, $) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var ImageCollection = {
|
|
|
|
init: function() {
|
|
|
|
this.setupTabs();
|
|
|
|
},
|
|
|
|
setupTabs: function() {
|
2015-10-21 02:55:23 +00:00
|
|
|
var $imageCollections = $('.pi-image-collection');
|
2015-10-20 16:40:56 +00:00
|
|
|
|
2015-10-21 02:55:23 +00:00
|
|
|
$imageCollections.each( function( index, collection ) {
|
|
|
|
var $collection = $imageCollections.eq(index),
|
|
|
|
$tabs = $collection.find('ul.pi-image-collection-tabs li'),
|
|
|
|
$tabContent = $collection.find('.pi-image-collection-tab-content');
|
2015-10-20 16:40:56 +00:00
|
|
|
|
2015-10-21 02:55:23 +00:00
|
|
|
$tabs.click( function() {
|
|
|
|
var $target = $(this),
|
|
|
|
tabId = $target.attr('data-pi-tab');
|
2015-10-20 16:40:56 +00:00
|
|
|
|
2015-10-21 02:55:23 +00:00
|
|
|
$tabs.removeClass('current');
|
|
|
|
$tabContent.removeClass('current');
|
2015-10-20 16:40:56 +00:00
|
|
|
|
2015-10-21 02:55:23 +00:00
|
|
|
$target.addClass('current');
|
|
|
|
$collection.find('#' + tabId).addClass('current');
|
|
|
|
});
|
2015-10-20 16:40:56 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ImageCollection.init();
|
|
|
|
})(window, jQuery);
|