I have created a calendar with CLNDR.js. Everything works very well but I want to pass the selected date into Underscore to show only the events day.
Part of my clndr html:
<div class="events-list">
<% _.each(eventsThisMonth, function(event) { %>
<!--<% if (event.date == selectedDate) { %>-->
<div class="event">
<a href="<%= event.url %>">. <%= event.location %></a>
</div>
<!--<% } %>-->
<% }); %>
</div>
Script:
$(window).load(function(){
$('#mini-clndr').clndr({
template: $('#calendar').html(),
events: events,
clickEvents: {
click: function(target) {
if(target.events.length) {
var selectedDate = target.date['_i'];
var controls = $('#mini-clndr').find('.controls');
var daysContainer = $('#mini-clndr').find('.days-container');
var eventsContainer = $('#mini-clndr').find('.events');
controls.slideUp( "slow" );
daysContainer.slideUp( "slow" );
eventsContainer.slideDown( "slow" );
$('#mini-clndr').find('.x-button').click( function() {
controls.slideDown( "slow" );
daysContainer.slideDown( "slow" );
eventsContainer.slideUp( "slow" );
});
}
}
},
adjacentDaysChangeMonth: false
});
});
Someone can help me? It's the first time I use Underscore.js
Aucun commentaire:
Enregistrer un commentaire