0

我在這些情況下使用鼠標向下和鼠標移動jQuery事件來更改我的光標。這似乎適用於除IE 10和11以外的所有瀏覽器。我找不到任何資源可以說明爲什麼這樣做不起作用或替代這些事件。任何幫助?mousedown和光標事件不會觸發

$("#element").mousedown(function(){ 
    $(this).css("cursor" , "move"); 
}).mouseup(function(){ 
    $(this).css("cursor" , "default"); 
}); 
+0

Internet Explorer'遊標'css屬性是越野車:[鏈接](http://stackoverflow.com/a/17694522/4532601)。 – 98du 2015-02-05 14:08:35

回答

0

我用以下標記在IE 11和它的工作如預期:

$(function() { 
 
    $("#div1").mousedown(function() { 
 
     $(this).css("cursor", "move"); 
 
    }).mouseup(function() { 
 
     $(this).css("cursor", "default"); 
 
    }); 
 
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div class="container body-content"> 
 
    <div id="div1" style="width: 100px; height: 100px; background-color: red;"> 
 
    &nbsp; 
 
    </div> 
 
</div>

確保事件被附連到所述元件?

+0

是的,相同的代碼在Chrome,Firefox,Safari和IE 9上工作正常。 我不認爲這是一個遊標問題,當我調試代碼出於某種原因,甚至沒有訪問mousedown函數時。 – girlintech 2015-02-05 14:44:33