(function (window) {
'use strict';
if (window.CatalogElement)
return;
window.CatalogElement = function (arParams , ajaxParams) {
this.params = arParams;
this.ajaxParams = ajaxParams;
this.tabs = {
obTabs: BX('tabs-nav'),
obTabsScroll: 'tabs-nav-scroll',
objTopTabNav: {
description: BX('description-tab'),
characteristic: BX('characteristic-tab'),
set: BX('set-tab'),
video: BX('video-tab'),
documents: BX('documents-tab'),
payment: BX('payment-tab'),
delivery: BX('delivery-tab')
},
objScrollTabNav: {
description: BX('description-tab-fix'),
characteristic: BX('characteristic-tab-fix'),
set: BX('set-tab-fix'),
video: BX('video-tab-fix'),
documents: BX('documents-tab-fix'),
payment: BX('payment-tab-fix'),
delivery: BX('delivery-tab-fix')
}
};
this.error = {};
this.init();
};
window.CatalogElement.prototype = {
init: function ()
{
this.initTabs();
},
/* region Tabs */
initTabs: function()
{
BX.bind(this.tabs.objTopTabNav.description , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.characteristic , 'click', BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.set , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.video , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.documents , 'click', BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.payment , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objTopTabNav.delivery , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.description , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.characteristic , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.set , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.video , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.documents , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.payment , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(this.tabs.objScrollTabNav.delivery , 'click' , BX.proxy(this.tabSelect, this));
BX.bind(BX('characteristic-link') , 'click' , BX.proxy(this.tabSelect, this));
},
tabSelect: function()
{
var element = BX.proxy_context;
$('html, body').animate({ scrollTop: $($(element).attr('href')).offset().top }, 1500);
$($(element).attr('href')).tab('show');
},
};
})(window);