From b79abd8de8b1359d7248abfc6f146f44dc4c0833 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 7 Apr 2010 14:36:27 +0200 Subject: [PATCH] blinking cursor --- CursorLayer.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CursorLayer.js b/CursorLayer.js index b7efcbb6..28a16148 100644 --- a/CursorLayer.js +++ b/CursorLayer.js @@ -24,12 +24,23 @@ CursorLayer.prototype.hideCursor = function() if (this.cursor.parentNode) { this.cursor.parentNode.removeChild(this.cursor); } + clearInterval(this.blinkId); }; CursorLayer.prototype.showCursor = function() { this.isVisible = true; this.element.appendChild(this.cursor); + + var cursor = this.cursor; + cursor.style.visibility = "visible"; + + this.blinkId = setInterval(function() { + cursor.style.visibility = "hidden"; + setTimeout(function() { + cursor.style.visibility = "visible"; + }, 400); + }, 1000); }; CursorLayer.prototype.getPixelPosition = function() {