问题描述
我目前希望实现移动菜单系统的 mmenu ()到我们的网站Asp.Net
am currently looking to implement the mobile menu system mmenu (http://mmenu.frebsite.nl/) into our Asp.Net site.
也是在主网页的HTML网页上的伟大工程,只要它的形式标记之外。当我把它的形式标记它不再有效范围内。
Works great on an HTML page and also in the Master page, so long as it's outside the form tag. When I put it within the form tag it no longer works.
下面是HTML的菜单:
Here is the HTML for the menu:
<nav id="menu">
<ul>
<li><a href="page.html">The page</a></li>
<li><a href="mainmenu.html">The mainmenu</a></li>
<li><a href="submenus.html">Submenus</a></li>
<li><a href="labels.html">Labels</a></li>
<li><a href="counters.html">Counters</a></li
<li><a href="selected.html">Selected item</a></li>
<li><a href="openmenu.html">Open the menu</a></li>
<li><a href="closemenu.html">Close the menu</a></li>
</ul>
</nav>
这是运行罚款:
<script type="text/javascript">
$(function () {
$('nav#menu').mmenu({
zposition: "next",
position: "top"
});
});
</script>
不过,如果我把它的形式标记(表格ID =MainForm的=服务器),我得到一个jQuery误差范围内。需要进行内,某些菜单项将来自于数据库中。
But then if I put it within the form tag (form id="MainForm" runat="server") I get a jquery error. Needs to be within as some menu items will come from the database.
干杯
西蒙
推荐答案
Mmenu做两件事情,当它被初始化。首先,它包装的innerHTML的&LT;身体GT;
与&LT; DIV CLASS =mmenu页的&GT;
容器,然后它削减了&LT;导航&GT;
的菜单和移动那些之间的&LT;身体GT;
并在DOM新页面的容器。
Mmenu does two things when it is initialized. First, it wraps the innerHTML of the <body>
with a <div class="mmenu-page">
container, and then it cuts out the <nav>
for the menus and moves those between the <body>
and new page container in the DOM.
无论出于何种原因,它将该ASP.Net包装&LT;形式&GT;
标记,如&LT;身体GT;
标签,但只有当它显示为&LT的第一个孩子,身体GT;
。如果是这样的话,它插入它的包装&LT; DIV&GT;形式&GT;
标记立即结束&LT以下。
For whatever reason, it treats the ASP.Net wrapping <form>
tag like the <body>
tag, but only if it appears as the first child of the <body>
. When this is the case, it inserts it's wrapping <div>
immediately following the closing <form>
tag.
如果你换你ASP.Net &LT;形式&GT;
带标签的空&LT; DIV&GT;
,mmenu可以针对它的&LT; DIV CLASS =mmenu页的方式&gt;
正确,一切都奇迹般地工程
If you wrap your ASP.Net <form>
tag with an empty <div>
, mmenu will be able to target it's <div class="mmenu-page">
correctly and everything magically works.
您会希望您的code aspx页面看起来像这样:
You'll want your code aspx page to look like this:
<body>
<div>
<form id="form1" runat="server">
...
<nav> ...mobile menu... </nav>
</form>
</div>
<body>
这篇关于mmenu菜单系统不净的表单标签内工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!