无法隐藏jeegoocontext制作的上下文菜单

时间:2012-02-02 12:45:07

标签: javascript jquery contextmenu

以下是我正在处理的网站示例的链接:
https://grenada.lumc.nl/LOVD3/shared/genes

我正在尝试隐藏由jeegoocontext生成的上下文菜单(当鼠标悬停在页面顶部的选项卡上时弹出的菜单,例如“放映”)。当我将鼠标悬停在选项卡上时,将显示上下文窗口。但是,当我没有实际触摸上下文菜单时(例如从顶部退出顶部)鼠标输出标签时,上下文菜单不会隐藏,我无法这样做。

如果我在退出前让鼠标覆盖了菜单,那么它的行为应该如此。有没有人有一个解决方案,不涉及使用不同于jeegoocontext的库?

编辑:
这是jeegoocontext zip链接,其中包含jeegoocontext文件夹中的原始.js文件 http://www.planitworks.nl/uploads/afbeelding/components/downloads/jeegoocontext_1_3.zip

干杯,

lugte098

1 个答案:

答案 0 :(得分:0)

尝试将您的脚本放在页面的页脚中,如下所示:

$(document).ready(function(){
    var aMenuOptions = {
        widthOverflowOffset: 0,
        heightOverflowOffset: 1,
        startLeftOffset: -20,
        event: "mouseover",
        openBelowContext: true,
        autoHide: true,
        delay: 100,
        onSelect: function(e, context){
            if($(this).hasClass("disabled"))
            {              
                return false;
            } else {
                window.location = $(this).find("a").attr("href");
                return false;
            }
        },
    };
    $('#tab_genes').jeegoocontext('menu_tab_genes', aMenuOptions);
    $('#tab_transcripts').jeegoocontext('menu_tab_transcripts', aMenuOptions);
    $('#tab_variants').jeegoocontext('menu_tab_variants', aMenuOptions);
    $('#tab_individuals').jeegoocontext('menu_tab_individuals', aMenuOptions);
    $('#tab_diseases').jeegoocontext('menu_tab_diseases', aMenuOptions);
    $('#tab_screenings').jeegoocontext('menu_tab_screenings', aMenuOptions);
    $('#tab_submit').jeegoocontext('menu_tab_submit', aMenuOptions);
});

问题是脚本可能在hmtl DOM完成之前运行。 试试这个。