Here's the fiddle.当我点击打开它的链接时,为什么这个div不会关闭?
的代码包括:
$('.icon').click(function() {
$('.foo').toggle();
});
$(document).mouseup(function (e) {
var container = $('.foo');
if (!container.is(e.target) // if the target of the click isn't the container...
&&
container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});
我可以使用链接来打开它,代码关闭它,当一个点击它的外面,但我不能打开它的链接关闭原来。
http://jsfiddle.net/gT5BT/104/ – rps