絶対位置を持つ複数の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;
}