Created
March 20, 2010 16:45
-
-
Save cowboy/338759 to your computer and use it in GitHub Desktop.
Damn browser crash...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var supports_onhashchange = 'onhashchange' in window, | |
last_hash = location.hash, | |
timeout_id; | |
$.event.special.hashchange = { | |
setup: function() { | |
if ( supports_onhashchange ) { return false; } | |
start(); | |
}, | |
teardown: function() { | |
if ( supports_onhashchange ) { return false; } | |
stop(); | |
} | |
}; | |
function start() { | |
var hash = location.hash; | |
if ( hash !== last_hash ) { | |
$(window).trigger( 'hashchange' ); | |
last_hash = hash; | |
} | |
timeout_id = setInterval( start, 100 ); | |
}; | |
function stop() { | |
clearTimeout( timeout_id ); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment