div 상자가 있습니다. 사용자가 마우스를 가져 가거나 마우스를 가져 가면 다음 div가 표시되고 사용자 mouseout이 보이는 div가 fadeout해야합니다. 내 기능이 제대로 작동하지 않습니다.jquery의 Mouseenter 및 Mouseleave 기능
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$('.box').bind({
mouseenter: function(){
$(this).next().fadeIn('fast')
},
mouseout: function(){
$(this).next().fadeOut('fast')
}
})
})
</script>
<style>
body { margin:0}
.box { height:300px; width:300px; background:#F00}
.boxcaption { width:300px; height:300px; background:#00F; position:absolute; left:0; top:0; display:none}
</style>
</head>
<body>
<div class="wrap">
<div class="box"></div>
<div class="boxcaption"></div>
</div>
</body>
그러면 문제는 무엇입니까? –
문제는 다음 요소가 대상 바로 위에 위치하고 일단 나타나면 원래 요소를 "떠나"새 요소를 가리키게됩니다 (다시 fadeOut이 발생 함) – poncha