2012-10-31 65 views
1

我想不突出元素,當我拖我的一些元素,併爲此我做了這個防止鼠標按下

$('#object') 
.draggable() 
.mousedown(function(event) { 
    event.preventDefault(); 
}); 

但現在我遇到一個問題,突出的文字,我的其他元素的事件,如模糊沒有調用。 例如,當焦點進入元素並且該元素具有模糊事件時,當我選擇了我的可拖動元素時,前一個元素的模糊事件沒有被調用。

我該如何處理這個問題。我也不知道我在mousedown事件中調用blur事件的哪個元素焦點。

+2

嘗試CSS ... [http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting](http:/ /stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting) 'user-select:none;' –

+0

當你第一次分配'mosuedown'時發生什麼,然後讓你的obuckct'dragabble '? – Reflective

+0

感謝您的幫助,我想我必須通過css規則來處理這個問題 – AKZ

回答

4

嘗試:

$('#object').css('user-select','none').prop('unselectable','on').on('selectstart',false);