0

我有这个小脚本,当用户在日历中的日期上使用鼠标时,我可以显示条目。我想更改它以将其设置为 onclick 功能,但我不知道如何做到这一点:

这是代码的一部分:

// Customisation Variables
                /** The CSS class which will be assigned to the Event Calendar */
                calendarClass: 'hasEventCalendar',
                /** The CSS class which will be assigned to day when the day contains a entry */
                dayEventClass: 'ui-state-active hasEvent',
                /** The standard options to send to the datepicker */
                datepickerOptions: {
                    firstDay: 1 /* Monday */
                },
                /** Whether or not to disable the datepicker date selection click */
                disableClick: true,
                /**
                 * The domEvents option contains all the events which you would like to assign to a $day
                 *
                 * It will send the following arguments back to you:
                 * - domEvent
                 * - details
                 *
                 * The details of the details argument contains the following:
                 * - {Number} year
                 * - {Number} month
                 * - {Number} day
                 * - {String} date
                 * - {Array} dayEntries
                 * - {Array} monthEntries
                 * - {Element} datepicker
                 */
                domEvents: {
                    mouseenter: function(domEvent, details) {
                        // Prepare
                        var $day = $(this),
                            dayEntries = details.dayEntries;
                        // Output
                        $.each(dayEntries,function(i,entry){
                            $eventsInfo.append(
                                '<p>'+
                                    '<strong>'+entry.title+'</strong> <br/>'+
                                    '<em>'+entry.start.toLocaleDateString()+'</em>'+
                                    '<br>'+entry.text+''+
                                '</p>'
                            );
                        });
                    },
                    mouseleave: function(domEvent, details) {
                        // Clear
                        $eventsInfo.empty();
                    }
                }

我该如何修改它?

4

1 回答 1

0

更改to的mouseenter属性,如下所示:domEventsonclick

// Customisation Variables
                /** The CSS class which will be assigned to the Event Calendar */
                calendarClass: 'hasEventCalendar',
                /** The CSS class which will be assigned to day when the day contains a entry */
                dayEventClass: 'ui-state-active hasEvent',
                /** The standard options to send to the datepicker */
                datepickerOptions: {
                    firstDay: 1 /* Monday */
                },
                /** Whether or not to disable the datepicker date selection click */
                disableClick: true,
                /**
                 * The domEvents option contains all the events which you would like to assign to a $day
                 *
                 * It will send the following arguments back to you:
                 * - domEvent
                 * - details
                 *
                 * The details of the details argument contains the following:
                 * - {Number} year
                 * - {Number} month
                 * - {Number} day
                 * - {String} date
                 * - {Array} dayEntries
                 * - {Array} monthEntries
                 * - {Element} datepicker
                 */
                domEvents: {
                    onclick: function(domEvent, details) {
                        // Prepare
                        var $day = $(this),
                            dayEntries = details.dayEntries;
                        // Output
                        $.each(dayEntries,function(i,entry){
                            $eventsInfo.append(
                                '<p>'+
                                    '<strong>'+entry.title+'</strong> <br/>'+
                                    '<em>'+entry.start.toLocaleDateString()+'</em>'+
                                    '<br>'+entry.text+''+
                                '</p>'
                            );
                        });
                    },
                    mouseleave: function(domEvent, details) {
                        // Clear
                        $eventsInfo.empty();
                    }
                }
于 2013-04-30T15:53:46.057 回答