Closed pushred closed 11 years ago
Can I have more code to evaluate this problem with? This is very unclear at the moment.
$(function(){
fightclub.on('load', function(){
...
});
});
… works.
$(window).load(function() {
fightclub.on('load', function(){
...
});
});
… does not work. I am trying to manage load order in this case so that's why I'm using this method.
This is probably due to the Fanclub's load event firing before window load. Since the binding happens after the fanclub has loaded, it is never fired.
Ok, would you recommend checking for the instantiated customer object then rather than using this event? Can I be sure that the fan club will be loaded when $(window).load is triggered?
Since I'm such a nice guy, here's what I'll do:
load
should only ever fire once, since each instantiated fanclub only loads once. This means I can internally set a flag that tells me if it's loaded or not. Then if you try to bind to the load
event after it's fired, I can just immediately fire your callback.
The following callback isn't being executed when I use
$(window).load()
vs.$(document).ready()