这是我的菜单JavaScript功能。现在我的菜单打开,点击关闭点击&。 我想打开鼠标离开按钮时点击&关闭。如何使用鼠标点击并关闭来打开javascript菜单
$("#theme_select").click(function() {
if (theme_list_open == true) {
$(".center ul li ul").hide();
theme_list_open = false;
} else {
$(".center ul li ul").show();
theme_list_open = true;
}
return false;
});
即时编辑一人&顶部问题修复。但是当我想将鼠标移动到打开的菜单项目菜单被关闭。看到我完整的脚本(变更前):
<script type="text/javascript">
var theme_list_open = false;
$(document).ready(function() {
function fixHeight() {
var headerHeight = $("#switcher").height();
$("#iframe").attr("height", (($(window).height() - 1) - headerHeight) + 'px');
}
$(window).resize(function() {
fixHeight();
}).resize();
$("#theme_select").click(function() {
if (theme_list_open == true) {
$(".center ul li ul").hide();
theme_list_open = false;
} else {
$(".center ul li ul").show();
theme_list_open = true;
}
return false;
});
$("#theme_list ul li a").click(function() {
var theme_data = $(this).attr("rel").split(",");
$("li.purchase a").attr("href", theme_data[1]);
$("li.remove_frame a").attr("href", theme_data[0]);
$("#iframe").attr("src", theme_data[0]);
$("#theme_list a#theme_select").text($(this).text());
$(".center ul li ul").hide();
theme_list_open = false;
return false;
});
});
</script>
['.hover()'](http://api.jquery.com/hover /) – PeeHaa
Peehaa是你的答案吗? – VoronoiPotato
@VoronoiPotato不,这是一个问题... – 2012-12-04 21:23:15