Created
May 18, 2015 15:12
-
-
Save isotrope/09a0858ec771cf2abbdb to your computer and use it in GitHub Desktop.
Basic jQuery/JavaScript starter file to re-use. (Also, WP-jQuery-version-safe)
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
; | |
MyObject = typeof MyObject === 'undefined' ? {} : MyObject; | |
(function ($) { | |
$.noConflict(); | |
MyObject.module1 = { | |
init : function () { | |
var _this = MyObject.module1; | |
_this.$mainContainer = $('.main-container'); | |
if (_this.$mainContainer.length > 0) { | |
_this.bindEvents(); | |
} | |
}, | |
bindEvents: function () { | |
var _this = MyObject.module1; | |
} | |
}; | |
// Put all the functionality that needs to run immediately here | |
$(document).ready(function () { | |
// Put all the functionality that needs to run on doc.ready here | |
MyObject.module1.init(); | |
}); | |
$(window).load(function () { | |
// Put all the functionality that needs to run on window.load here | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment