jQuery和jquery.typetype.min.js(压缩后只有578个字节)加入你的页面。
1 2 | <script type="text/javascript" src="jquery.typetype.js"></script> |
然后您可以添加一些文本textareas,输入或其他HTML元素。
1 | $('textarea').typetype('Some text that you want to demo') |
自定义输入
1 2 3 4 5 6 7 8 9 10 11 12 13 | $('textarea').typetype( 'Text to append', { e: 0.04, // error rate. (use e=0 for perfect typing) t: 100, // interval between keypresses keypress: function (){ // called after every keypress (this may be an erroneous keypress!) }, callback: function (){ // the `this` keyword is bound to the particular element. } }) |
backspace jQuery plugin
同样的道理,你可以通过这个可行的方法将文本文字后退
1 2 3 4 5 6 7 8 | $('textarea').backspace( 14, // number of chars to backspace { t: 100, // interval between keypresses keypress: function (){ }, callback: function (){ } }) |
结合jQuery动画
这两个jQuery插件关联在一起可以使可读性更好,更连贯
1 2 3 4 5 6 | $('textarea') .typetype('Hello, world!') .delay(1000) .typetype('\n\nGoodbye.') .backspace(25) .fadeOut() // regular jQuery effects queue up nicely |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com