jQuery Address do not work in callbacks
-
20-06-2021 - |
Question
Today I explored something weird: jQuery Address do not work in jQuery callbacks: http://jsfiddle.net/Wh7uS/19/ Any suggestions?
Solution
Your binding to the init event of the address, which is triggered before the callback. You can see that if you change the fadein timer to 0:
$("#second").fadeIn(0, function() {
jQuery.address.init(function(event) {
alert("jQuery Address - inside");
});
alert("Sorry for the many alerts");
});
It's callback will run immediately, binding the init event handler which will be invoked and shoot of the alert (all from in the callback). Timing is everything :)
OTHER TIPS
Are you looking for something like that? http://jsfiddle.net/Wh7uS/18/
change jquery to jquery <1.6
and things work fine.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow