English 中文(简体)
如果我用 @ Html. ActionLink 替换 <a>, Jmenu jquery 插件将无效
原标题:Jmenu jquery plugin will not work if i replave the <a> with @Html.ActionLink

我的Asp.net mvc3网络应用程序里有以下JMenu:

<ul id="jMenu"> <li><a class="fNiv">Home</a>
                <!-- Do not forget the "fNiv" class for the first level links !! --> 
                <ul> <li class="arrow"></li> 
                <li><a>Category 1.2</a> 
                <ul> <li><a>Category 1.3</a></li> 
                <li><a>Category 1.3</a></li> 

But if i replace the <a class="fNiv">Home</a> with <div class="fNiv">@Html.ActionLink("Home", "Index", "Home")</div>, then the Jmenu will not show the submenus when i move the mouse over the Home action link. So is there a way to let the Jmenu works on @htmk.actionlink same as for the links BR

<强> : :: 更新 : -

我改变了我的Html。 动作链接成为

<li>@Html.ActionLink("Home", "Index", "Home", new { @class="fNiv" }, null)

但当我移动鼠标到菜单上时, 我发现错误如下:

Microsoft JScript runtime error: ULWidth is undefined on the following code:-

ChildList.css({top:position.top,left:position.left+ULWidth,width:ULWidth}).children().css({width:ULWidth
最佳回答

正如评论所说,您应该将“ fNiv” 类应用到第一级锚 。 ) :

在插件中,它们将所有应用到“fniv”类的锁定与鼠标对事件的“fniv”类以显示子菜单。因此,如果你不在父链接上应用“fniv”类,则该子菜单将永远不显示。

        /* Actions on parents links */
        if(!opts.openClick)
        $( #jMenu li a.fNiv ).bind({
            mouseover:function(){
                var $this = $(this);
                var $child = $this.next();
                ULWidth = $.jMenu._returnUlWidth($this);
                $.jMenu._closeList($("#jMenu ul"));
                if($child.is( :hidden ))
                    $.jMenu._showFirstChild($this);
            }
        });
        else
        $( #jMenu li a.fNiv ).bind({
            click:function(e){
                e.preventDefault();
                var $this = $(this);
                var $child = $this.next();
                ULWidth = $.jMenu._returnUlWidth($this);
                $.jMenu._closeList($("#jMenu ul"));
                if($child.is( :hidden ))
                    $.jMenu._showFirstChild($this);
            }
        });

EDIT : Replace <a class="fNiv">Home</a> with this. <%[email protected]("Home", "Index", "Home", new { @class="fNiv" })%> It should work fine.

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签