2012-03-28 291 views
3

我希望當我將鼠標移動到標籤上時我警告(「某事」),我嘗試了很多功能,但總是隻有當我點擊標籤時纔會起作用,它在標籤上! 我曾嘗試:Jquery移動和鼠標懸停事件

$("#show").mouseover(function(){ 
    alert("something"); 
}); 

$("#show").mouseenter(function(){ 
    alert("something"); 
}); 

$("#show").live('vmouseover', function() { 
    alert("something"); 
}); 

$("#show").hover(
    function() { 
    alert("something"); 
}); 
+0

作爲@Jivings說,鼠標事件不會對手機正常工作,您正在尋找一個交替觸摸事件。 – 2012-03-28 09:51:14

回答

1

你想看看那個jQuery的移動提供移動特定的虛擬事件。他們的描述可以在這裏找到:

http://jquerymobile.com/demos/1.1.0-rc.1/docs/api/events.html

特別是,你所要求的鼠標懸停:

$("#show").vmouseover(function(){ 
    alert("something"); 
}); 
+0

但我已經嘗試vmouseover,面臨同樣的問題! – Aminesrine 2012-03-28 09:53:31

+0

@Bouaziz你已經在移動設備上測試過了嗎? – Jivings 2012-03-28 09:56:49

+0

不,我與一個Android模擬器工作 – Aminesrine 2012-03-28 09:58:25