jQuery上下文菜单打开对话框

时间:2012-08-17 09:31:52

标签: jquery dialog contextmenu

它适用于带有链接(a href =“www.google.com”)的A Href,但不适用于散列#like(a href =“#”)。我想要做的是在单击包含#href的上下文菜单项之一时打开jquery对话框。 Fyi,使用没有jquery上下文菜单的标准链接,无论有没有#。

我的代码:

<ul id="myMenu" class="contextMenu">
    <li><a href="#" id='cmsharefolder_link' class='sharefolder_link'>
        <img src='../style/images/sharefolders.png' title='Share' />
        Share
        </a>
    </li>
    <li><a href="#" class="move_link" >
        <img src="../style/images/move.png" title="Move Folder"/>
        Move</a>
    </li>

</ul>

Jquery上下文菜单:

    $(document).ready( function() {

        // Show menu when #myDiv is clicked
        $("#list TR").contextMenu({
            menu: 'myMenu'
        },

        function(action, el, pos) {
            $(el).attr('id').trigger('click');
        }

        );

    });

#:

的对话框
    $(function(){
        // Dialog for moving file / folder      
        $('.move').dialog({ autoOpen: false, width: 600, modal: true });

        // Dialog for moving file / folder link
        $('.move_link').click(function(){ $('.move').dialog('open'); return false; });  

        // Dialog for moving file / folder      
        $('.sharefolder').dialog({ autoOpen: false, width: 600, modal: true });

        // Dialog for share folder link
        $('.sharefolder_link').click(function(){ $('.sharefolder').dialog('open'); sharedfolder(); return false; });                
    });

答案在kannix的评论中使用了动作参数(例如退出)

1 个答案:

答案 0 :(得分:0)

可能是你可以试试

href="javascript:void(0)"