183 | | |
| 183 | window.onhashchange = function() { |
| 184 | if(location.hash.length < 2) |
| 185 | return; |
| 186 | var stripped = location.hash.substr(1); |
| 187 | if(stripped.search(/^\d+$/) != -1) { |
| 188 | self.gotoSlide($(self.$slides[parseInt(stripped)-1])); |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | var targetEl = $("a[name="+stripped+"]").add("#"+stripped).get(0); |
| 193 | while(targetEl) |
| 194 | { |
| 195 | if($(targetEl).hasClass("slide")) |
| 196 | { |
| 197 | var slideNo = parseInt($(targetEl).attr('id'))-1; |
| 198 | self.gotoSlide($(self.$slides[slideNo])); |
| 199 | return; |
| 200 | } |
| 201 | targetEl = targetEl.parentNode; |
| 202 | } |
| 203 | |
| 204 | }; |