Created
December 1, 2011 17:57
-
-
Save cayasso/1418585 to your computer and use it in GitHub Desktop.
Description
This file contains 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
special[ str_hashchange ] = $.extend( special[ str_hashchange ], { | |
// Called only when the first 'hashchange' event is bound to window. | |
setup: function() { | |
// If window.onhashchange is supported natively, there's nothing to do.. | |
if ( supports_onhashchange ) { return false; } | |
// Otherwise, we need to create our own. And we don't want to call this | |
// until the user binds to the event, just in case they never do, since it | |
// will create a polling loop and possibly even a hidden Iframe. | |
$( fake_onhashchange.start ); | |
}, | |
// Called only when the last 'hashchange' event is unbound from window. | |
teardown: function() { | |
// If window.onhashchange is supported natively, there's nothing to do.. | |
if ( supports_onhashchange ) { return false; } | |
// Otherwise, we need to stop ours (if possible). | |
$( fake_onhashchange.stop ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment