我有一個div和一個簡單的jQuery代碼,它在'onlclick'事件中調用div並正確隱藏'onmouseout'事件。問題是當我把一個文本或鏈接放在這個div裏,並將光標移動到這個div的文本/鏈接上時 - 它會觸發out()函數效果並消失 - 即使光標仍在div內。爲什麼 ?感謝您的評論。div在鏈接上隱藏onmouseover事件
<script src="js/jquery.js"></script>
<style type="text/css">
#sample {
position:relative;
width:500px;
height:200px;
background-image:url(images/img.png);
background-repeat:repeat-x;
}
</style>
</head>
<body>
<a href="javascript:show();" >link</a>
<div id="sample" onmouseout="out()"><a href="">THIS IS TEXT</a></div>
<script type="text/javascript">
$(document).ready(function() {
$("#sample").hide();
});
function show() {
$("#sample").fadeIn('slow');
}
function out() {
$("#sample").fadeOut('slow');
}
</script>
</body>
</html>
我已經放在#sample外的鏈接,並定位它放在#sample格 - 當你搬過來吧... –
@epascarello正是我一直在尋找它仍然隱藏因爲 - 非常感謝很多人! –