Этот код должен ждать, пока пользователь не нажмет на что-то другое, кроме div id = "s", а затем вернется на свое место, но он сразу же запускает запуск при нажатии. Я хочу, чтобы он оставался открытым!
Вот код и jsfiddle: http://jsfiddle.net/hBb9L/
$("#e").click(function() {
//done
$("#re").animate({
"margin-top": "104px"
}, 800);
$("#ret").animate({
"margin-top": "104px"
}, 800);
$(".popu").animate({
"margin-top": "-102px"
}, 800);
$("#s").show(200);
$("div:not(#s)").click(function() {
$("#re").animate({
"margin-top": "0px"
}, 800);
$("#ret").animate({
"margin-top": "0px"
}, 800);
$(".popu").animate({
"margin-top": "0px"
}, 800);
$("#s").hide(200);
});
});
Ваша потребность .stopPropagation()
$("#e").click(function (e) {
//done
$("#re").animate({
"margin-top": "104px"
}, 800);
$("#ret").animate({
"margin-top": "104px"
}, 800);
$(".popu").animate({
"margin-top": "-102px"
}, 800);
$("#s").show(200);
e.stopPropagation();
});