2012-05-25 47 views
0
$(".post").hover(function(){ 
      $(".buttons input", this).show(); 

     }); 

一旦鼠標熄滅後,再次隱藏同一元素的最簡單方法是什麼?我努力使類似YouTube發佈內容(按鈕顯示/隱藏在鼠標上)jquery懸停類似於youtube按鈕

回答

2

顯示標記

基於假設,

$(".post").hover(function(){ 
     $(".buttons input", this).fadeIn('slow'); 
}, 
function(){ 
$(".buttons input", this).fadeOut('slow'); 
}); 
+0

確切說,謝謝。雖然我不明白它是如何工作的。 – domino

+1

'.hover()'方法爲mouseenter和mouseleave事件綁定處理程序。它有兩個函數作爲參數,第一個用於'mouseenter',第二個用於'mouseleave'。請參閱[本](http://api.jquery.com/hover/) – Jashwant