Created
August 16, 2011 04:41
-
-
Save markbrown4/1148446 to your computer and use it in GitHub Desktop.
Controls
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
var Page = { | |
init: function() { | |
Controls.init(); | |
} | |
} | |
// Lets go | |
var $body = $("body"); | |
$(document).ready(Page.init); | |
var Controls = { | |
init: function() { | |
Controls.initWithin(document); | |
}, | |
initWithin: function(el) { | |
$(el).find('.init').each(function() { | |
var name = $(this).attr('data-control'); | |
var control = Controls[name]; | |
if (control.initOnce) { | |
control.initOnce.call(this); | |
control.initOnce = false; | |
} | |
if (control.init) | |
control.init.call(this); | |
}); | |
} | |
} | |
Controls.Superman = { | |
initOnce: function() { | |
}, | |
init() { | |
var $this = $(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment