我想顯示隱藏DIV(一類.details
)不工作,每當在一個頁面中的元素.tags
鼠標懸停。這是工作,但不是預期的。 我希望鼠標應該能夠進入顯示的.details
,甚至應該能夠點擊它的內容,因爲我們在這裏在StackOverflow標籤 但是當鼠標離開.tags
一切都消失了。我該如何延遲.details
的外觀,並讓鼠標在.tags
上鼠標懸停時可以選擇其內容 ?的jQuery的hide()和show()如預期
HTML代碼:
<div class = 'tags'>
<div class='details'>
<a href='a.html'> jQuery </a>
<a href='b.html'> PHP </a>
<a href='c.html'> MySQL </a>
<a href='d.html'> Ruby on Rails </a>
</div>
</div>
CSS代碼:
.details {
background-color: rgb(235,243,243);
border-radius: 7px;
padding: 3px;
width: 240px;
float: left;
position: relative;
margin-top: 5px;
font-weight: 400;
}
jQuery代碼:
$(document).ready(function(){
$('.details').hide();
$(document).on('mouseover', ".tags", function() {
var $this = $(this);
$this.find('.details').slideDown(100);
});
$(document).on('mouseleave', ".tags", function() {
var $this = $(this);
$this.find('.details').hide();
});
});
感謝您在ADVAN CE。
導航創建的jsfiddle請,在此代碼'tags'不是用戶可見。 – Pinal
我已經讀了你的問題3次,我仍然不明白你的問題... 「鼠標葉'.details'一切都消失了 - 」從你的代碼,這是預期的結果。 「延遲外觀」 - 所以當用戶將鼠標懸停在'.tags' div上時不想顯示細節? –
我已經複製你的代碼。懸停時顯示'.details',我可以點擊鏈接。如果遠離隱藏的細節,這是不是預期的行爲? –