mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-16 04:22:37 +00:00
32 lines
747 B
JavaScript
32 lines
747 B
JavaScript
|
(function (window, $) {
|
||
|
'use strict';
|
||
|
|
||
|
var ImageCollection = {
|
||
|
init: function() {
|
||
|
this.setupTabs();
|
||
|
},
|
||
|
setupTabs: function() {
|
||
|
var $imageCollection = $('.pi-image-collection'),
|
||
|
$tabs = $('ul.pi-image-collection-tabs li'),
|
||
|
$tabContent = $('.pi-image-collection-tab-content');
|
||
|
|
||
|
$tabs.first().addClass('current');
|
||
|
$tabContent.first().addClass('current');
|
||
|
|
||
|
$imageCollection.on('click', 'ul.pi-image-collection-tabs li', function( event ) {
|
||
|
var $target = $(this),
|
||
|
tabId = $target.attr('data-pi-tab');
|
||
|
|
||
|
$tabs.removeClass('current');
|
||
|
$tabContent.removeClass('current');
|
||
|
|
||
|
$target.addClass('current');
|
||
|
$('#' + tabId).addClass('current');
|
||
|
});
|
||
|
|
||
|
}
|
||
|
};
|
||
|
|
||
|
ImageCollection.init();
|
||
|
})(window, jQuery);
|