문제는 당신이 그들을 바인딩 해제하지 않고 이벤트를 리 바인드하는 것 같다 : 여기
<script type="text/javascript">
$(document).ready(function() {
//add mouseover event to the search button to show the search box
$(".search").mouseover(
function() {
$(".open").show();
});
//add mouseout event to the search button to show the hide box
$(".search").mouseout(
function() {
$(".open").hide();
});
//add mouseover event to the search box so it doesnt hide when the user attempts to click the box
$(".open").mouseover(
function() {
$(".open").show();
});
//add mouseout event to the search box so it doesnt hides when the users mouse exits the box
$(".open").mouseout(
function() {
$(".open").hide();
});
//don't ever hide the search box when the textbox has focus
$("#tbSearch").focus(
function() {
$(".open").mouseout(
function() {
$(".open").show();
});
});
//hide the search box when the textbox loses focus
$("#tbSearch").blur(
function() {
$(".open").hide();
$(".open").mouseout(
function() {
$(".open").hide();
});
});
});
</script>
그리고 HTML입니다. 따라서 포커스와 흐림 이벤트가 몇 번 발생했는지에 따라 상자를 숨기고 표시하는 여러 이벤트가 발생합니다. 어떤 이유로 IE에서 왜 실패하는지 정확히 알 수는 없지만 솔루션에는 움직이는 부분이 너무 많아서 정확히 어디에서 오류가 발생했는지 정확하게 알 수 없습니다.
필자는 과거에 텍스트 상자의 상태를 유지하는 속성 (집중 또는 흐려짐)을 사용하여이 유형의 작업을 수행 할 수있었습니다. 이 밖으로 시도 :
<script type="text/javascript">
$(function() {
var showBox = function() {
$(".open").show();
};
var hideBox = function() {
if (!$(".open").attr("searching")) {
$(".open").hide();
}
};
$(".search").hover(showBox, hideBox);
$(".open").hover(showBox, hideBox).hide();
$("#tbSearch").focus(function() {
$(".open").attr("searching", "true");
}).blur(function() {
$(".open").removeAttr("searching");
$(".open").hide();
});
});
</script>
이가! 덕분에 절대적으로 완벽하게 작동 –