我正在为我的网站使用 mmenu jquery 插件。 现在我注意到最新版本中的搜索字段可以配置为搜索表单。
1.我如何意识到这一点?
我的正常搜索表单如下所示:
<form action="search.html" method="post">
<input type="text" name="item" id="searchform" placeholder="Search" />
<button type="submit" name="submit" id="searchbutton">Search</button>
<input type="hidden" name="do" value="search" />
<input type="hidden" name="searchin" value="all" />
<input type="hidden" name="send" value="1" />
</form>
我已经尝试过这个,但它不起作用:
$("#menu").mmenu({
navbars: { content: [ "prev", "searchfield", "close" ] },
searchfield: {
search: false,
form: {
action: "search.html",
method: "post" },
input: {
type: "text",
name: "item",
id: "searchform" },
input: {
type: "hidden",
name: "do",
value: "search" },
input: {
type: "hidden",
name: "searchin",
value: "all" },
input: {
type: "hidden",
name: "send",
value: "1" }
}
});
2.是否可以将搜索字段移至菜单末尾?
谢谢!
请您参考如下方法:
我知道这是一个旧线程,但以防万一有人也在寻找答案
为了在搜索字段中使用自定义表单,您需要添加配置,而不是选项。所以,正确的格式是:
$("#menu").mmenu({ navbars: { content: [ "prev", "searchfield", "close" ] }, searchfield: { search: false } },{ "searchfield": { form: { action: "search.html", method: "post" }, input: { type: "text", name: "item", id: "searchform" } } });您可以更改导航栏位置:
“导航栏”:[ { “位置”:“底部”, “内容”: [ “搜索字段” ] } ]
