Anthony Pipkin![]()
Renders a full list of calendar days. Always displays 6 weeks to keep the calendar the same height.
The calendar controls are not part of the calendar widget because of the large number of unique setups. These could easily be generated from plugins.
In this example the controls are part of the page and added to the widget when it is rendered.
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script> <div id="selected"><span></span></div>
<div id="controls">
<button class="prev-year"><<</button>
<button class="prev-month"><</button>
<span class="monthYear"></span>
<button class="next-month">></button>
<button class="next-year">>></button>
</div>
<div id="cal"></div>
<script type="text/javascript">
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.02.02-21-07'
}).use('gallery-xarno-calendar', function(Y){
var c = new Y.Xarno.Calendar({dateSelected: (new Date())}),
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
c.on('update', function(e) {
var d = c.get('date');
Y.one('.monthYear').setContent(months[d.getMonth()] + ' ' + d.getFullYear());
});
c.after('select', function(e) {
var d = c.get('dateSelected');
Y.one('#selected span').set('text', months[d.getMonth()] + ' ' + d.getDate() + ', ' + d.getFullYear());
});
c.render('#cal');
c.set('headerContent', Y.one('#controls'));
c.set('footerContent', Y.one('#selected'));
Y.one('.prev-year').on('click', c.prevYear, c);
Y.one('.prev-month').on('click', c.prevMonth, c);
Y.one('.next-month').on('click', c.nextMonth, c);
Y.one('.next-year').on('click', c.nextYear, c);
});
</script>No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info