2013-06-03 59 views
0

一些非常簡單的代碼:event.preventDefault()不適用於jQuery移動?

$(document).on('pagebeforeshow', '#promotional-page', function(){ 
    $(".win-anchor").on('vmousedown', function(event){ 
     event.preventDefault(); 
    }); 
}); 

爲什麼它仍然重定向到鏈接的頁面?

+0

你確定它是'vmousedown'事件是否正在解僱?可能還有另外一個事件你也需要預防。 –

+0

'pagebeforeshow'你用'pageinit'試過了嗎? – Jai

回答

1

工作例如:http://jsfiddle.net/Gajotres/y5jyt/

這將工作的跨平臺。

$(document).on('pagebeforeshow', '#promotional-page', function(){  
    $(document).on('vmousedown click', '.win-anchor',function(event){ 
     event.preventDefault(); 
     return false; 
    }); 
}); 
相關問題