Skip to content

Commit

Permalink
Fix bug not allowing use of in-element string.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmacarthur committed Jan 21, 2016
1 parent 4ba587e commit 190d573
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
9 changes: 4 additions & 5 deletions dist/typeit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* jQuery TypeIt
* @author Alex MacArthur (http://macarthur.me)
* @version 2.0.1
* @version 2.0.2
* @copyright 2016 Alex MacArthur
* @description Types out a given string or strings.
*/
Expand Down Expand Up @@ -125,11 +125,10 @@ $.fn.typeIt.typeItClass = function(theElement, options, callback){

_proto.testForElementStringOverride = function() {
// if there's a string already typed in the element, replace whatToType with it

if(this.theElement.text().length > 0 && !this.theElement.has('.ti-container')) {
this.settings.whatToType = this.theElement.html();
if(this.theElement.text().length > 0) {
this.settings.whatToType = this.theElement.text().trim();
}

};

_proto.setupDOMComponents = function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/typeit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typeit",
"version": "2.0.1",
"version": "2.0.2",
"license": "GPL-2.0",
"author": "Alex MacArthur <alex@macarthur.me>",
"description": "A lightweight, easy-to-implement jQuery animated typing plugin that types text for you.",
Expand All @@ -13,7 +13,8 @@
"jquery",
"plugin",
"animated",
"typing"
"typing",
"typewriter"
],
"main": "dist/typeit.min.js",
"bugs": {
Expand Down
13 changes: 5 additions & 8 deletions sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@

<section>

<span class="typeit-box"
data-typeit-whattotype='["A new string to type.","hello..."]'
data-typeit-speed="100"
data-typeit-lifelike="true"
data-typeit-showcursor="true"
data-typeit-loop="true"
data-typeit-loopdelay="1000">
<span id="typeItBox">
Testing an in-element string!
</span>

</section>

<script src="../src/jquery-2.1.4.min.js"></script>
<script src="../dist/typeit.min.js"></script>
<script>
$('.typeit-box').typeIt();
$('#typeItBox').typeIt({
loop: true
});
</script>

</body>
Expand Down
9 changes: 4 additions & 5 deletions src/typeit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* jQuery TypeIt
* @author Alex MacArthur (http://macarthur.me)
* @version 2.0.1
* @version 2.0.2
* @copyright 2016 Alex MacArthur
* @description Types out a given string or strings.
*/
Expand Down Expand Up @@ -125,11 +125,10 @@ $.fn.typeIt.typeItClass = function(theElement, options, callback){

_proto.testForElementStringOverride = function() {
// if there's a string already typed in the element, replace whatToType with it

if(this.theElement.text().length > 0 && !this.theElement.has('.ti-container')) {
this.settings.whatToType = this.theElement.html();
if(this.theElement.text().length > 0) {
this.settings.whatToType = this.theElement.text().trim();
}

};

_proto.setupDOMComponents = function() {
Expand Down

0 comments on commit 190d573

Please sign in to comment.