日期:2014-05-16 浏览次数:20405 次
function hider(obj) {
jQuery("div.comment-item").mouseover(function() {
$(obj).find(".op-lnks").css("visibility","visible");
});
jQuery("div.comment-item").mouseout(function() {
$(obj).find(".op-lnks").css("visibility","hidden");
});
}
<div class="comment-item" onmouseover="hider(this);">
<div>user1</div>
<div style="visibility:hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>
<div class="comment-item" onmouseover="hider(this);">
<div>user2</div>
<div style="visibility:hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>
<div class="comment-item" onmouseover="hider(this);">
<div>user3</div>
<div style="visibility:hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
jQuery("div.comment-item").mouseover(function() {
$(this).find(".op-lnks").css("visibility","visible");
}).mouseout(function() {
$(this).find(".op-lnks").css("visibility","hidden");
});
});
</script>
<div class="comment-item">
<div>user1</div>
<div style="visibility: hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>
<div class="comment-item">
<div>user2</div>
<div style="visibility: hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>
<div class="comment-item">
<div>user3</div>
<div style="visibility: hidden" class="op-lnks">
<a href="">回应</a>
</div>
</div>
</div>