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.
96 lines
2.4 KiB
96 lines
2.4 KiB
var EXPO = EXPO || {}; //isolated namespace
|
|
if (EXPO.about) {
|
|
console.warn('WARNING: EXPO.about is already defined!');
|
|
} else {
|
|
EXPO.about = (function () {
|
|
/**
|
|
* private (visible inside this module only) variables
|
|
*/
|
|
/**
|
|
* @type {Object} - module API interafce realization
|
|
*/
|
|
var that = {};
|
|
/**
|
|
* @type {Object} default setting
|
|
*/
|
|
that.opt = {};
|
|
/**
|
|
* dependencies.Place where you can switch on dependencies for module
|
|
* @type {EXPO.common|*} - mostly used in project functions and data (block.common.js)
|
|
*/
|
|
var com = EXPO.common;
|
|
|
|
/**
|
|
* tabs object constructor
|
|
* @param options - options (id's and classes to specifie HTML elements)
|
|
* @constructor
|
|
*/
|
|
var Tabs = function (options) {
|
|
this.opt = options;
|
|
var self = this,
|
|
opt = this.opt,
|
|
tabClass = opt.tabClass,
|
|
activeClass = opt.activeClass;
|
|
/**
|
|
* tabs navigation menu
|
|
* @type {*|jQuery|HTMLElement}
|
|
* @public
|
|
*/
|
|
this.$tabsList = $('#'+opt.listId);
|
|
/**
|
|
* tabs body container
|
|
* @type {*|jQuery|HTMLElement}
|
|
* @public
|
|
*/
|
|
this.$tabs = $('#'+opt.tabsId);
|
|
/**
|
|
* short peview for content of each tabs
|
|
* @type {*|jQuery|HTMLElement}
|
|
* @public
|
|
*/
|
|
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 = {
|
|
/**
|
|
* make specified tab visible
|
|
* @param tabId - tab DOM id pararmeter
|
|
* @public
|
|
*/
|
|
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);
|
|
|
|
}
|
|
};
|
|
/**
|
|
* current module general initialization
|
|
* @param {Object} options - options recieved from web page view
|
|
*/
|
|
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;
|
|
}());
|
|
}
|
|
|