2
2
Function: TabInterface()
3
3
Author: Aaron Gustafson (aaron at easy-designs dot net)
4
4
Creation Date: 7 December 2006
5
- Version: 0.4
5
+ Version: 0.4.1
6
6
Homepage: http://github.com/easy-designs/tabinterface.js
7
7
License: MIT License (see MIT-LICENSE)
8
8
Note: If you change or improve on this script, please let us know by
9
9
emailing the author (above) with a link to your demo page.
10
10
------------------------------------------------------------------------------*/
11
11
function TabInterface ( el , i ) {
12
12
// Public Properties
13
- this . Version = '0.4' ; // version
13
+ this . Version = '0.4.1 ' ; // version
14
14
15
15
// Private Properties
16
16
var _i = i ; // incrementor
@@ -110,9 +110,9 @@ function TabInterface( el, i ){
110
110
function swap ( e )
111
111
{
112
112
e = ( e ) ? e : event ;
113
- var tab = e . target || e . srcElement ,
114
- old_folder = document . getElementById ( _active ) ,
115
- new_folder = document . getElementById ( tab . folder ) ;
113
+ var tab = e . target || e . srcElement , old_folder = document . getElementById ( _active ) ;
114
+ tab = getTab ( tab ) ;
115
+ var new_folder = document . getElementById ( tab . folder ) ;
116
116
removeClassName ( document . getElementById ( _active + '-tab' ) , 'active-tab' ) ;
117
117
removeClassName ( old_folder , 'visible' ) ;
118
118
old_folder . setAttribute ( 'aria-hidden' , 'true' ) ;
@@ -135,13 +135,22 @@ function TabInterface( el, i ){
135
135
}
136
136
e . className = classes . join ( ' ' ) ;
137
137
}
138
+ function getTab ( tab )
139
+ {
140
+ while ( tab . nodeName . toLowerCase ( ) != 'li' )
141
+ {
142
+ tab = tab . parentNode ;
143
+ }
144
+ return tab ;
145
+ }
138
146
function moveFocus ( e )
139
147
{
140
148
e = ( e ) ? e : event ;
141
149
var
142
150
tab = e . target || e . srcElement ,
143
151
key = e . keyCode || e . charCode ,
144
152
pass = true ;
153
+ tab = getTab ( tab ) ;
145
154
switch ( key )
146
155
{
147
156
case 37 : // left arrow
0 commit comments