From 75c9266ef3410b8bfd9c42bf04ac6910a6bd156a Mon Sep 17 00:00:00 2001 From: Johannes Neumeier Date: Mon, 13 May 2013 22:39:06 +0300 Subject: [PATCH] added option tapeColor --- README.md | 3 ++- src/jquery.typer.js | 7 ++++--- test.html | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3be0145..2b4d069 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ There are some options that are available to you as well: typeDelay : 200, clearOnHighlight : true, typerDataAttr : 'data-typer-targets', - typerInterval : 2000 + typerInterval : 2000, + tapeColor : 'auto' // 'auto' or a css color value } ``` diff --git a/src/jquery.typer.js b/src/jquery.typer.js index 9c59e25..8482796 100644 --- a/src/jquery.typer.js +++ b/src/jquery.typer.js @@ -19,7 +19,8 @@ String.prototype.rightChars = function(n){ typeDelay : 200, clearOnHighlight : true, typerDataAttr : 'data-typer-targets', - typerInterval : 2000 + typerInterval : 2000, + tapeColor : 'auto' }, highlight, clearText, @@ -130,7 +131,7 @@ String.prototype.rightChars = function(n){ .append( spanWithColor( $e.data('backgroundColor'), - $e.data('primaryColor') + $.typer.options.tapeColor === 'auto' ? $e.data('primaryColor') : $.typer.options.tapeColor ) .append(highlightedText) ) @@ -224,7 +225,7 @@ String.prototype.rightChars = function(n){ $e.data('oldRight', currentText.rightChars(j - 1)); $e.data('leftStop', i); $e.data('rightStop', currentText.length - j); - $e.data('primaryColor', $e.css('color')); + $e.data('primaryColor', $.typer.options.tapeColor === 'auto' ? $e.data('primaryColor') : $.typer.options.tapeColor); $e.data('backgroundColor', $e.css('background-color')); $e.data('text', newString); highlight($e); diff --git a/test.html b/test.html index a9311f0..1cf9fc3 100644 --- a/test.html +++ b/test.html @@ -2,8 +2,12 @@ - - + + +

Hello, World!

@@ -11,9 +15,21 @@

Welcome

+

Hello World!

+ +
+

Hello World!

+
+ +

+