dayClick上的FullCalendar打开引导模式

Geo*_*rge 4 fullcalendar twitter-bootstrap

当用户在fullCalendar中点击一天时,我想打开一个bootstrap模式.我查看了dayClick事件,但无法弄清楚如何调用模型.

dayClick: function(date, jsEvent, view) {
     // call the model 
},
Run Code Online (Sandbox Code Playgroud)

调用bootstrap模型的普通链接

<a href="#" data-toggle="modal" data-target="#myModal"..................../>
Run Code Online (Sandbox Code Playgroud)

编辑:

我只使用1个引导模型来满足我的所有需求,只需更改内容即可.我这样做的方法是调用一个href ..所以我的链接看起来像:

<a href="<?php echo site_url('model/add') ?>" data-toggle="modal" data-target="#myModal" role="button" class="btn-u btn-block"> Add</a>
Run Code Online (Sandbox Code Playgroud)

Geo*_*rge 18

如果其他人需要在bootstrap模型中打开fullCalendar事件,我找到了这样做的方法:

添加:

        eventClick:  function(event, jsEvent, view) {
            $('#modalTitle').html(event.title);
            $('#modalBody').html(event.description);
            $('#eventUrl').attr('href',event.url);
            $('#calendarModal').modal();
        },
Run Code Online (Sandbox Code Playgroud)

而型号:

<div id="calendarModal" class="modal fade">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only">close</span></button>
            <h4 id="modalTitle" class="modal-title"></h4>
        </div>
        <div id="modalBody" class="modal-body"> </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

  • 来源:http://www.mikesmithdev.com/blog/fullcalendar-event-details-with-bootstrap-modal/ (3认同)

小智 5

以下应该工作:

dayClick: function(date, jsEvent, view) {
    $("#myModal").modal("show");
},
Run Code Online (Sandbox Code Playgroud)

假设您的模态ID实际上是myModal.modal()是引导程序用来操作模态的JavaScript方法。类似地,您可以使用$("#myModal").modal("hide")... 来关闭模态