質問

I know that this is supposed to work, it works fine in 1.7.2

//click anywhere to close dropdown
$("html").live("click", function () {
    closeDropdown();
});

//on click of ellipsis, open dropdown
$("span.PivotEllipsis").click(function (e) {
    e.stopPropagation();
    openDropdown();
});

It is the classic click outside span.PivotEllipsis to hide. However, the problem is that the second function is not working. The first is working fine, when you click outside, it hides. However, when you click on the span.Pivot Ellipsis it doesn't pop up, instead I think, hard to tell though, that it runs openDropdown() and then immediately after closeDropdown()....

Anyone know what it wrong?

役に立ちましたか?

解決

According to jQuery Documentation: "it is not possible to stop propagation of live events." You don't really need to use .live() as the html element exists at document.ready and isn't dynamically loaded

他のヒント

What you thought is probably correct - you need to disable the first function while the dropdown menu is not open.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top