Reputation: 24099
Below is my js class.
I need it to execute once all images are loaded, I understand I need to do this via:
$(window).load
But how would I incorporate this into my class?
this.mc = this.mc || {};
(function () {
"use strict";
var MyClass = function () {
this.init();
};
p.init = function () {
// Init
this.ready();
};
mc.MyClass = MyClass;
}(window));
var myClass;
$(function () {
myClass = new mc.MyClass();
});
Upvotes: 0
Views: 45
Reputation: 236192
I'm not quite sure if I get you.. but
window.onload = function() {
myClass = new mc.MyClass();
};
should do.
Upvotes: 0
Reputation: 35223
Replace
$(function () {
myClass = new mc.MyClass();
});
with
$(window).on('load', function() {
myClass = new mc.MyClass();
});
Upvotes: 3