;(function($, window, document, undefined) { var leotextanimate = function(eles, opts) { this.element = $(eles); this.string = $(eles).html(); this.defaults = { speed: 1000, autorun: true, delay: 0, fixed: '', start: '' }; this.options = $.extend({}, this.defaults, opts); this.height = $(eles).height(); } leotextanimate.prototype = { init: function() { if (this.element.find('.textanimate').length <= 0) { var html = method.gethtml(this.options, this.string); this.element.html(html); } this.reset(); if (this.options.autorun) { if (this.options.delay == 0) { this.run(); } else { var $this = this; settimeout(function() { $this.run(); }, this.options.delay); } } }, reset: function() { var $this = this.element.find('.textanimate'); $this.css({ 'overflow': 'hidden', 'display':'inline-block', 'vertical-align':'top', 'height': this.height }).find("span").css({ 'display': 'inline-block', 'vertical-align': 'top', 'position': 'relative', 'top': '0px', 'transform': 'translatey(0px)', '-ms-transform': 'translatey(0px)', '-moz-transform': 'translatey(0px)', '-webkit-transform': 'translatey(0px)', '-o-transform': 'translatey(0px)', '-ms-transition': '0s', '-moz-transition': '0s', '-webkit-transition': '0s', '-o-transition': '0s', 'transition': '0s' }).find("i").css({ 'display': 'block', 'font-style': 'normal', 'height': this.height }); }, run: function() { var speed = this.options.speed; var height = this.height; this.reset(); this.element.find("span").each(function() { var $this = $(this); var length = $this.find('i').index($this.find('.on')); var to = -length * height + 'px'; if (to != $this.css("top")) { if (!window.applicationcache) { $this.animate({ top: to }, speed); } else { $this.css({ 'transform': 'translatey(' + to + ')', '-ms-transform': 'translatey(' + to + ')', '-moz-transform': 'translatey(' + to + ')', '-webkit-transform': 'translatey(' + to + ')', '-o-transform': 'translatey(' + to + ')', '-ms-transition': speed / 1000 + 's', '-moz-transition': speed / 1000 + 's', '-webkit-transition': speed / 1000 + 's', '-o-transition': speed / 1000 + 's', 'transition': speed / 1000 + 's' }); } } }); } } var method = { getnumber: function(options, string) { if(!this.inarr(options.fixed, string)) { var text = ''; if (options.start !== '') { text += '' + options.start + ''; } for (var i = 0; i < 10; i++) { text += '' + i + ''; } return text + ''; } else { return '' + string + ''; } }, getlowercase: function(options, string, code) { if (!this.inarr(options.fixed, string)) { var text = ''; if (options.start !== '') { text += '' + options.start + ''; } for (var i = 0; i < 26; i++) { text += '' + string.fromcharcode(97 + i) + ''; } return text + ''; } else { return '' + string + ''; } }, getuppercase: function(options, string, code) { if (!this.inarr(options.fixed, string)) { var text = ''; if (options.start !== '') { text += '' + options.start + ''; } for (var i = 0; i < 26; i++) { text += '' + string.fromcharcode(65 + i) + ''; } return text + ''; } else { return '' + string + ''; } }, getunicode: function(options, string, code) { if (!this.inarr(options.fixed, string)) { var text = ''; if (options.start !== '') { text += '' + options.start + ''; } for (var i = (code - this.getrand(2, 7)); i < (code + this.getrand(3, 10)); i++) { text += '' + string.fromcharcode(i) + ''; } return text + ''; } else { return '' + string + ''; } }, gethtml: function(options, string) { var html = '