2

我想使用显示像 Google Calendar 这样的工具提示/弹出窗口。

每当用户单击日期单元格时,应该会弹出一个屏幕,我想在其中显示自定义 HTML/PHP 代码。当用户输入值时,我想使用 PHP 将其保存在数据库中。

4

4 回答 4

1

我认为eventRender回调更适合这个。

检查这个小提琴:http: //jsfiddle.net/100thGear/h9cC6/

于 2012-09-04T15:12:00.180 回答
0

您可以使用几个不同的库(例如http://www.jquerypopup.com/)。

然后使用这样的东西:

$(document).ready(function() {
    //Change these values to style your modal popup
    var align = 'center';                                       //Valid values; left, right, center
    var top = 100;                                              //Use an integer (in pixels)
    var padding = 10;                                           //Use an integer (in pixels)
    var backgroundColor = '#FFFFFF';                            //Use any hex code
    var borderColor = '#000000';                                //Use any hex code
    var borderWeight = 4;                                       //Use an integer (in pixels)
    var borderRadius = 5;                                       //Use an integer (in pixels)
    var fadeOutTime = 300;                                      //Use any integer, 0 = no fade
    var disableColor = '#666666';                               //Use any hex code
    var disableOpacity = 40;                                    //Valid range 0-100
    var loadingImage = 'lib/release-0.0.1/loading.gif'; //Use relative path from this page

    //This method initialises the modal popup
    $(".modal").click(function() {
        var source = 'intro.php';   //Refer to any page on your server, external pages are not valid
        var width = 500;                    //Use an integer (in pixels)

        modalPopup(align, top, width, padding, disableColor, disableOpacity, backgroundColor, borderColor, borderWeight, borderRadius, fadeOutTime, source, loadingImage);
    }); 

    //This method initialises the modal popup
    $(".landscape").click(function() {
        var source = 'lib/landscape.jpg';   //Refer to any page on your server, external pages are not valid
        var width = 920;                    //Use an integer (in pixels)
        var top = 10;                       //Use an integer (in pixels)

        modalPopup(align, top, width, padding, disableColor, disableOpacity, backgroundColor, borderColor, borderWeight, borderRadius, fadeOutTime, source, loadingImage);
    });

    //This method hides the popup when the escape key is pressed
    $(document).keyup(function(e) {
        if (e.keyCode == 27) {
            closePopup(fadeOutTime);
        }
    });
});

或者在没有插件的情况下使用这个选项:How to generate a simple popup using jQuery

我发现 jQuery Mobile 插件非常有用:

http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/

<script src="../../../js/jquery.mobile-1.2.0-alpha.1.js"></script>
<a href="#popupBasic" data-rel="popup">Open Popup</a>

<div data-role="popup" id="popupBasic">
    <p>This is a completely basic popup, no options set.<p>
</div>
于 2012-09-04T07:12:34.330 回答
0

看看我的小提琴链接FullCalendar with QTip

参考这个FullCalendar Document eventRender。下面是示例代码片段。

事件渲染

$('#calendar').fullCalendar({
  events: [
    {
      title: 'My Event',
      start: '2010-01-01',
      description: 'This is a cool event'
    }
    // more events here
  ],
  eventRender: function(event, element) {
    element.qtip({
      content: event.description
    });
  }
});
于 2013-06-19T11:25:33.817 回答
0

我设法回答了我自己的问题。我在 FullCalendar 初始化中添加了以下内容:

select: function(start, end, allDay, jsEvent, view){
    $('#addEvent').css({ left: jsEvent.pageX, top: jsEvent.pageY }).show("slow").fadeIn();
},

在该方法中,我使用了一个隐藏的 div,它存在于我的 HTML 中,如下所示:

<div id="addEvent" style="display: none; background-color:#F7F7F7;position: absolute; width: 300px; z-index: 1000;">
</div>
于 2012-09-04T08:05:56.863 回答