2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

マウスカーソルを消す

Posted at
hide_cursor.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset=UTF-8 />

    <script
       type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js">
    </script>

    <script
       type="text/javascript"
       src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js">
    </script>

    <script type="text/coffeescript">
      targetArea    = $('p#first') # カーソル変更対象部分
      controlButton = $('button')  # 操作ボタン

      # カーソルを見せボタンのイベントに hideCursor をバインドする
      showCursor = () ->
        targetArea.css('cursor', '')
        controlButton.text('消す')
        controlButton.click -> hideCursor()

      # カーソルを消しボタンのイベントに showCursor をバインドする
      hideCursor = () ->
        targetArea.css('cursor', 'none')
        controlButton.text('見せる')
        controlButton.click -> showCursor()
        
      $('button').click -> hideCursor() # 最初は[消す]ボタン
    </script>
  </head>

  <body>
    <h1>カーソルを消す</h1>
    <button tabindex=0 accesskey="h">消す</button>
    <p id="first">カーソル変更対象部分</p>
  </body>
</html>

なんかシンタックス・ハイライトがうまくいかない…。

2
1
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?