2016-11-21 77 views
0

我希望光標僅在div以內,且在此div以外不可見。這個怎麼做?如何獲取光標Invisbile或將焦點從DIV中移除

我正在使用jQuery拖放功能。當我將其移動到瀏覽器時。我需要修正一些特定的高度和寬度拖動作品只有特定的固定大小如何做到這一點?

+0

歡迎StackOverflow的。請注意,這不是一個免費的代碼寫入服務,但我們渴望幫助其他程序員(和有志之士)編寫他們自己的代碼。請閱讀[如何提出一個好問題](http://stackoverflow.com/help/how-to-ask)上的幫助主題。之後,請用您迄今編寫的代碼更新您的問題,以完成您希望實現的任務。 –

+0

你好羅伊,Welocome StackOverflow和檢查我的答案,希望它會對你有所幫助,並保持它的頭腦Quintin Balsdon說的事情:) 祝你好運 – SMW

回答

0

設置cursor:nonebody, htmlcursor: defaultdiv

body,html{ 
 
    cursor: none; 
 
    } 
 
#cursor{ 
 
    cursor: default; 
 
    background: red; 
 
    width: 100px; 
 
    height:100px; 
 
    position:absolute; 
 
    top:20px; 
 
    left:20px; 
 
    }
<div id="cursor"> 
 
    </div>

0

的解決方案將是如下:

CSS

div {cursor: auto } 

* { cursor: none; } 

但是,如果用戶不能看到指針,用戶如何找到div?

0
body { 
    cursor: none; 
} 

div { 
    cursor: auto; 
} 

應該這樣做!

0

可使用的CSS屬性是:

element.style { 
    cursor: none; 
} 

下面是示例代碼

.nocursor { 
 
     cursor: none; 
 
     
 
     padding: 2em; 
 
     border: 1px solid red; 
 
    }
<div class="nocursor"> 
 
     When you mouse hover in div class,cursor will be hide 
 
</div>