gpt4 book ai didi

javascript - Jquery div 正确打开/关闭隐藏的 div

转载 作者:搜寻专家 更新时间:2023-10-31 08:31:39 24 4
gpt4 key购买 nike

<分区>

我创建了一些代码,当单击 div("button") 时,这些代码将隐藏/取消隐藏隐藏的 div。我还希望在单击屏幕上的任何位置时隐藏 div。这些代码片段似乎相互冲突。

$(document).ready(function () {

$(document).on("click", "#help-icon", function () {
console.log('hi');
$("#help-menu").toggle();
});

$(document).mouseup(function (e) {
var hlpcont = $("#help-menu");
if (!hlpcont.is(e.target) &&
hlpcont.has(e.target).length === 0) {
hlpcont.hide();
}
});

});

jsfiddle:http://jsfiddle.net/CEs4c/1/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com