-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery
48 lines (45 loc) · 1.53 KB
/
jquery
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$( function() {
var $idxs = ( function() {
var $idxs = {}
// Group disperate indices
$('[idx]').each( function() {
var $g = $(this)
var idx = $g.idx = $g.idx || $g.attr( 'idx' )
$idxs[ idx ] = $idxs[ idx ] || $()
$idxs[ idx ] = $idxs[ idx ].add( $g )
} )
$idxs.each = function( f ) {
for( idx in $idxs ) {
if( idx != 'each' ) {
f.apply( $idxs[ idx ], [ $idxs[ idx ], idx ] )
}
}
}
$idxs.each( function( $g, idx ) {
if( $g ) {
$g.hover(
function() {
$idxs.each( function( $h, iidx ) {
if( $h ) {
//console.log( '$idxs:ℓ:' + $idxs.length )
//$h.style = { 'fill-opacity' : .5 }
$h.attr( {
state : ( idx != iidx ? 'not ' : '' ) + 'hovered',
} )
}
} )
},
function() {
$idxs.each( function( $h, iidx ) {
if( $h ) {
$h.attr( {
state : '',
} )
}
} )
}
)
}
} )
} )()
} )