From: Barış Metin Date: Mon, 15 Jun 2009 11:43:27 +0000 (+0000) Subject: fix active tab selection. "this" changes regarding the context X-Git-Tag: PLEWWW-4.3-19~7 X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=commitdiff_plain;h=5cca62e8b0bc2ec61e87a7afbbbb31395ccf01c0 fix active tab selection. "this" changes regarding the context --- diff --git a/plekit/linetabs/linetabs.js b/plekit/linetabs/linetabs.js index 6430e0f..b0203e7 100644 --- a/plekit/linetabs/linetabs.js +++ b/plekit/linetabs/linetabs.js @@ -58,11 +58,6 @@ linetabs.prototype.init = function (div) { mt.setActive (mt.activeTab,false); }); - /* set active and current, default is index 0, set 'active' class otherwise */ - this.input_s.each ( function (input) { - if (input.hasClassName("active")) this.activeTab = this.currentTab = i; - }); - /* create slice object */ this.slideObj = this.ul.parentNode.appendChild(document.createElement("div")); this.slideObj.appendChild(document.createTextNode(String.fromCharCode(160))); @@ -76,6 +71,13 @@ linetabs.prototype.init = function (div) { this.aHeight = (this.ul.offsetTop + this.li_s[this.activeTab].offsetTop + this.input_s[this.activeTab].offsetTop); + my_object = this; + /* set active and current, default is index 0, set 'active' class otherwise */ + this.input_s.each ( function (input, index) { + if (input.hasClassName("active")) my_object.activeTab = my_object.currentTab = index; + }); + + this.initSlide(this.activeTab, true); };