我在页面上有一个带有事件列表的日历。当用户点击下一个或上一个按钮时,我希望用仅包含当前显示月份和年份的行的内容填充一个div。以下是这些行的结构(使用Drupal 7 Views创建)。
<div id="all-events">
<div class="views-rows">
<div class="field-date">
<div class="field-content">
<span>June 2011</span>
</div>
</div>
</div>
<div class="views-rows">
<div class="field-event-title">
<div class="field-content">
<span>Some Event</span>
</div>
</div>
</div>
</div>
我用jQuery做到了这一步,但是出现了很多错误:
$('#calendar span.fc-button-next').live('click', function(){
var month = $('#calendar .fc-header-title h2').html();
$('.event-list').fadeOut(350, function(){
$(this).html('');
$('#all-events').each('.views-rows',function(){
// Code goes here...
});
});
});
我还应该提一下,我正在使用FullCalendar创建日历,因此它是使用这个插件创建的。现在我可以获取用户正在查看的当前月份,但我想浏览列表并找到包含该月份的所有行,并将它们显示在.event-list div中。