I have a little problem closing my dialog box in JavaScript/jQuery on mouse exit.
here is the script
$().ready(function () {
$(".popup").live("mouseover", function () {
$(this).next().dialog();
});
$(".popup").live("mouseout", function () {
$(this).next().close();
});
});
Something like this will work:
Why is it that complicated? Well the
.dialog()call wraps the element and moves it to the end of the<body>element, so.next()won’t find it anymore. So…we need to store a reference to the relevant dialog.An alternative would be to position the dialog and stick it back in the DOM in a relative way when creating it, either way works.