ContextMenu与jQuery FullCalendar集成 [英] ContextMenu integration with jQuery FullCalendar
问题描述
我正在使用Adam Shaw的FullCalendar
控件以及jQuery.我想为事件和日期添加上下文菜单.通过使用 Martin Wendt的上下文菜单控件.我用于在事件上注册菜单的代码如下:
I'm using Adam Shaw's FullCalendar
control along with jQuery. I would like to add a context menu to events and days. I was able to achieve so by using Martin Wendt's Context Menu control. My code for registering the menu on events looks like this:
$('#calendar').fullCalendar({
// Other arguments
eventRender: function (event, element) {
var originalClass = element[0].className;
element[0].className = originalClass + ' hasmenu';
},
dayRender: function (day, cell) {
var originalClass = cell[0].className;
cell[0].className = originalClass + ' hasmenu';
});
});
我实质上是在日历中的每个事件和日期中添加一个名为hasmenu
的类.
I'm essentially adding a class called hasmenu
to each event and day in the calendar.
$(document).contextmenu({
delegate: ".hasmenu",
preventContextMenuForPopup: true,
preventSelect: true,
menu: [
{title: "Cut", cmd: "cut", uiIcon: "ui-icon-scissors"},
{title: "Copy", cmd: "copy", uiIcon: "ui-icon-copy"},
{title: "Paste", cmd: "paste", uiIcon: "ui-icon-clipboard", disabled: true },
],
select: function(event, ui) {
// Logic for handing the selected option
},
beforeOpen: function(event, ui) {
// Things to happen right before the menu pops up
}
});
此问题是菜单出现在日历控件的后面.我相信这是因为日历事件还分配了一些其他类,并且添加hasmenu
类会使这些事情变得混乱.当我在VS中设置断点时,它表示该事件具有以下类:
The problem with this is that the menu appears behind the calendar control. I believe this is because calendar events have a few other classes assigned to them and adding a hasmenu
class is messing with those. When I set a breakpoint in VS, it says the event has these classes:
"fc-event fc-event-hori fc-event-draggable fc-event-start fc-event-end hasmenu"
这是它在页面上的样子:
And this is how it looks on the page:
我尝试在打开弹出窗口时将事件类临时设置为hasmenu
,但这显然完全改变了视图.有没有一种方法可以强制菜单位于所有其他元素之上?是否有一种迎面而来"的方法?感谢您的帮助.
I tried temporarily setting the event class to just hasmenu
while the popup was open but that obviously changed the view entirely. Is there a way to force the menu to be on top of all other elements? Is there a "bring to front" method? Any help is appreciated.
推荐答案
调整z-index
可能是最好的选择.
Adjusting the z-index
will probably be your best bet.
这篇关于ContextMenu与jQuery FullCalendar集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!