diff --git a/jquery.textillate.js b/jquery.textillate.js index 7484c73..e6f1093 100644 --- a/jquery.textillate.js +++ b/jquery.textillate.js @@ -183,9 +183,17 @@ , data = $this.data('textillate') , options = $.extend(true, {}, $.fn.textillate.defaults, getData(this), typeof settings == 'object' && settings); - if (!data) { - $this.data('textillate', (data = new Textillate(this, options))); - } else if (typeof settings == 'string') { + if (data) { + var text; + if(!(text = $this.find('.texts').text())){ + text = $this.text(); + } + $this.empty(); + $this.text(text); + } + $this.data('textillate', (data = new Textillate(this, options))); + + if (typeof settings == 'string') { data[settings].apply(data, [].concat(args)); } else { data.setOptions.call(data, options); @@ -217,4 +225,4 @@ outEffects: [ 'hinge' ] }; -}(jQuery)); \ No newline at end of file +}(jQuery));