You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.6 KiB
60 lines
1.6 KiB
var EXPO = EXPO || {}; //isolated namespace
|
|
if (EXPO.about) {
|
|
console.warn('WARNING: EXPO.eventsFeed is already defined!');
|
|
} else {
|
|
EXPO.about = (function () {
|
|
// variables
|
|
var that = {};
|
|
//default module setting
|
|
that.opt = {};
|
|
//dependence's
|
|
var com = EXPO.common;
|
|
//private
|
|
var Tabs = function (options) {
|
|
this.opt = options;
|
|
var self = this,
|
|
opt = this.opt,
|
|
tabClass = opt.tabClass,
|
|
activeClass = opt.activeClass;
|
|
this.$tabsList = $('#'+opt.listId);
|
|
this.$tabs = $('#'+opt.tabsId);
|
|
this.$tabsOpenings = $('#'+opt.tabsOpeningId);
|
|
|
|
$('a',this.$tabsList).on('click', function () {
|
|
$(this).parent('li').addClass(activeClass).siblings().removeClass(activeClass);
|
|
var tabId = $(this).attr('href');
|
|
tabId = tabId.replace('#','');
|
|
self.setActive(tabId);
|
|
return false;
|
|
});
|
|
|
|
|
|
};
|
|
Tabs.prototype = {
|
|
initTabs: function () {
|
|
|
|
},
|
|
setActive: function (tabId) {
|
|
var activeClass = this.opt.activeClass,
|
|
tabClass = this.opt.tabClass,
|
|
postfix = this.opt.postfix;
|
|
this.$tabs.children('.'+tabClass).hide().removeClass(activeClass);
|
|
this.$tabs.children('#'+tabId).fadeIn(function () {
|
|
$(this).addClass(activeClass)
|
|
});
|
|
this.$tabsOpenings.children('.'+tabClass).removeClass(activeClass);
|
|
this.$tabsOpenings.children('#'+tabId+postfix).addClass(activeClass);
|
|
|
|
}
|
|
};
|
|
that.init = function (options) {
|
|
// settings extending
|
|
$.extend(this.opt, options);
|
|
// begin of initialization
|
|
var self = this;
|
|
this.tabs = new Tabs(this.opt.tabs);
|
|
|
|
};
|
|
return that;
|
|
}());
|
|
}
|
|
|