Hiding the mouse cursor when idle using JavaScript

后端 未结 7 1835
灰色年华
灰色年华 2021-02-14 01:29

Is it possible to use JavaScript to set the cursor attribute to the property none if the mouse is inactive for a certain amount of time (say, five seco

7条回答
  •  醉梦人生
    2021-02-14 02:22

    I have found a simple work-around to intermittent no-cursor problem, is to create a transparent

    as the last element on the page, and set the css style properties to:

    #overlay{
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: transparent;
    cursor: none;
    margin: 0;
    padding: 0;
    border: 0;
    }
    

    Make the javascript change the visibility to either "visible" or "hidden". A "visible" layer will hide the cursor. Vice-versa with hidden layer.

提交回复
热议问题