document ready function var SLIDE_SPEED 250 var ACTIVE_BULLET_CODE 655

 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$( document ).ready(function(){
var SLIDE_SPEED = 250;
var ACTIVE_BULLET_CODE = '↓';
var INACTIVE_BULLET_CODE = '➙';
$( '#left_menu li div' ).each(function(){
$( this ).css( { 'cursor' : 'pointer' , 'padding' : '2px 3px' } );
$( this ).mouseenter(function(){
$( this ).css( { 'background-color' : '#333' } );
});
$( this ).mouseleave(function(){
$( this ).css( { 'background-color' : 'transparent' } );
});
if ( $( this ).parent().find( '>ul' ).length ){
$( this ).append( '<span class="arrow-contents">&nbsp;' + INACTIVE_BULLET_CODE + '</span>' );
$( this ).find( 'span.arrow-contents' ).css( { 'font-weight' : 'bold' , 'font-size' : '14px' } );
$( this ).parent().find( '>ul' ).css( 'display' , 'none' );
$( this ).click(function(){
var _self = this;
$( this ).parent().find( '>ul' ).stop( true , true ).slideToggle( SLIDE_SPEED , function(){
if ( $( _self ).parent().find( '>ul' ).is( ':visible' ) ){
$( _self ).find( 'span.arrow-contents' ).html( '&nbsp;' + ACTIVE_BULLET_CODE );
} else {
$( _self ).find( 'span.arrow-contents' ).html( '&nbsp;' + INACTIVE_BULLET_CODE );
}
});
});
}
});
if ( $( '#left_menu li div.current-active' ).length ){
$( '#left_menu li div.current-active' ).parents( 'ul' ).css( 'display' , 'block' );
$( '#left_menu li div.current-active' ).unbind( 'mouseenter' );
$( '#left_menu li div.current-active' ).unbind( 'mouseleave' );
$( '#left_menu li div.current-active' ).css( { 'background-color' : 'transparent' } );
$( '#left_menu li div.current-active a' ).css(
{
'font-weight' : 'bold' ,
'color' : '#fff' ,
'border-left' : 'solid 3px #fff' ,
'padding-left' : '7px'
});
if ( $( '#left_menu li div.current-active' ).parent().find( '>ul' ).length ){
$( '#left_menu li div.current-active' ).parent().find( '>ul' ).css( 'display' , 'block' );
$( '#left_menu li div.current-active' ).find( 'span.arrow-contents' ).html( '&nbsp;' + ACTIVE_BULLET_CODE );
}
}
});