|
109 | 109 | } |
110 | 110 | shuffle ($('#banner a.external')); |
111 | 111 |
|
| 112 | + function preload_images() { |
| 113 | + var img = new Image(); |
| 114 | + img.src="_static/plusBox.png"; |
| 115 | + img.src="_static/minBox.png"; |
| 116 | + img.src="_static/plusBoxHighlight.png"; |
| 117 | + img.src="_static/plusBoxHighlight.png"; |
| 118 | + img.src="_static/noneBox.png"; |
| 119 | + } |
| 120 | + preload_images(); |
| 121 | + |
112 | 122 | //Function to make the index toctree collapsible |
113 | 123 | $(function () { |
114 | 124 | $('.toctree-l2') |
115 | 125 | .click(function(event){ |
116 | 126 | if (this == event.target) { |
117 | | - $(this).css('list-style-image', |
| 127 | + if ($(this).children('ul').length > 0) { |
| 128 | + $(this).css('list-style-image', |
118 | 129 | (!$(this).children('ul').is(':hidden')) ? 'url(http://github.com/_static/plusBox.png)' : 'url(http://github.com/_static/minBox.png)'); |
119 | | - $(this).children('ul').toggle(); |
| 130 | + $(this).children('ul').slideToggle(200); |
120 | 131 | } |
121 | 132 | return true; //Makes links clickable |
122 | | - }) |
123 | | - .mousedown(function(event){ return false; }) //Firefox highlighting fix |
124 | | - .css({cursor:'pointer', 'list-style-image':'url(http://github.com/_static/plusBox.png)'}) |
125 | | - .children('ul').hide(); |
| 133 | + } |
| 134 | + }) |
| 135 | + .mousedown(function(event){ return false; }) //Firefox highlighting fix |
| 136 | + .css({cursor:'pointer', 'list-style-image':'url(http://github.com/_static/plusBox.png)'}) |
| 137 | + .children('ul').hide(); |
126 | 138 | $('ul li ul li:not(:has(ul))').css({cursor:'default', 'list-style-image':'url(http://github.com/_static/noneBox.png)'}); |
127 | 139 | $('.toctree-l3').css({cursor:'default', 'list-style-image':'url(http://github.com/_static/noneBox.png)'}); |
128 | | - var sidebarbutton = $('#sidebarbutton'); |
129 | | - sidebarbutton.css({ |
130 | | - 'display': 'none' |
131 | | - }); |
| 140 | + var sidebarbutton = $('#sidebarbutton'); |
| 141 | + sidebarbutton.css({ |
| 142 | + 'display': 'none' |
| 143 | + }); |
132 | 144 |
|
133 | 145 | $('.toctree-l2').hover( |
134 | 146 | function () { |
135 | | - $(this).css('background-color', '#D0D0D0').children('ul').css('background-color', '#F0F0F0'); |
136 | 147 | if ($(this).children('ul').length > 0) { |
| 148 | + $(this).css('background-color', '#D0D0D0').children('ul').css('background-color', '#F0F0F0'); |
137 | 149 | $(this).css('list-style-image', |
138 | 150 | (!$(this).children('ul').is(':hidden')) ? 'url(http://github.com/_static/minBoxHighlight.png)' : 'url(http://github.com/_static/plusBoxHighlight.png)'); |
139 | 151 | } |
| 152 | + else { |
| 153 | + $(this).css('background-color', '#F9F9F9'); |
| 154 | + } |
140 | 155 | }, |
141 | 156 | function () { |
142 | 157 | $(this).css('background-color', 'white').children('ul').css('background-color', 'white'); |
|
0 commit comments