Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.html

Created Dec 11, 2016
Embed
What would you like to do?
6.md
$(function(){
var mainController = {
__name : 'h5.ui.container.MainController',
calendarController: h5.ui.components.Calendar,
__meta : {
calendarController: {
rootElement: '#container'
},
},
__init: function(){
var d = new Date;
this.$find("#year").val(d.getFullYear());
this.$find("#month").val(d.getMonth() + 1);
},
'#year change': function(context, $el) {
this.calendarController.setYear($el.val());
},
'#month change': function(context, $el) {
if ($el.val() != 12) {
$el.val($el.val() % 12);
}
this.calendarController.setMonth($el.val() - 1);
}
};
h5.core.controller('body', mainController);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment