好的,所以我在这里有一些工作要做。如果您遇到此帖子,请告诉我是否有更好的方法...
我最终创建了一个名为 MyTitle 的 Meta Tag,并为其提供了比较 ID 的内容,然后根据该 Meta Tag 显示 UL。
$(document).ready(function() {
$("#menu ul ul").hide();
$("#menu ul li").click(function()
{
$(this).next("ul").slideToggle(300).siblings("ul").slideUp("slow");
});
//created a meta tag called MyTitle to use as a way to open menu when needed. This function checks for the value of MyTitle. Got this from (http://forums.macrumors.com/showthread.php?t=569947)
var mytitle;
var metas = document.getElementsByTagName('meta');
for (var x=0,y=metas.length; x<y; x++) {
if (metas[x].name.toLowerCase() == "mytitle") {
mytitle = metas[x];
}
}
//Find the page currently on and display menu if need be.
var title = "" + mytitle.content;
if(title == "Resources")
$("ul #resources").show();
if(title == "Conferences")
$("ul #conferences").show();
ETC..........