我有一个包含多个具有绝对位置的 div 的 div,我想为父 div 处理鼠标输入事件我使用这个小提琴: 小提琴 它不能正常工作是他们处理这个问题的任何其他方式吗?
HTML 标记
<div id="content">
SYDNEY (Reuters) - An Australian man had his driving licence suspended for 10 months and was fined after he was
<div class="abs"></div>
caught driving a scooter made of a motorised beer cooler capable of carrying several dozen drinks -- after knocking back a few.
</div>
<div id="output">
</div>
脚本
$(function() {
var output = $("#output");
$("#content")
.mouseenter(function(e){
output.text("I'm in!");
}).mouseout(function(e) {
output.text("I'm out!");
});
});
#content {
background-color:#cccc99;
position:relative;
}
.abs{
position:absolute;
top:0px;
left:70px;
background-color:red;
width:30px;
height:30px;
}