检测点击背景事件 [英] Detect click on background event

查看:85
本文介绍了检测点击背景事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Fullcalendar 日历,我在其上添加了一些背景事件。这些背景事件表示无法单击或拖入的插槽。有没有办法检测到这种情况(用户点击后台事件)?

解决方案

后台事件呈现为DIV类名为fc-bgevent。

检测点击后台事件的代码是:

  element.fullCalendar({
...
dayClick:function(date,jsEvent,view){
if(jsEvent.target.classList.contains('fc );
alert('Click Background Event Area');
}
},
...
});


I have a Fullcalendar calendar and I add on it some background events. Those background events represent slots that cannot be clicked or dragged into. Is there a way to detect this (that the user clicked on a background event)?

解决方案

Background event is rendered as a DIV with the class name fc-bgevent.

My code for detecting the click background event is:

element.fullCalendar({ 
    ...
    dayClick: function(date, jsEvent, view) {
        if (jsEvent.target.classList.contains('fc-bgevent')) {
            alert('Click Background Event Area');
        }
    },
    ...
});

这篇关于检测点击背景事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆