简单使用方法
1、引用typewriter.js。
2、所要打字效果的html代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | < div id = "code" > < span class = "comments" >/**</ span >< br /> < span class = "space" />< span class = "comments" >* We are both XXX Unversity business administration and programmers,</ span >< br /> < span class = "space" />< span class = "comments" >* so I write some code to show my love to you.</ span >< br /> < span class = "space" />< span class = "comments" >*/</ span >< br /> Boy i = < span class = "keyword" >new</ span > Boy(< span class = "string" >"boyname"</ span >);< br /> Girl u = < span class = "keyword" >new</ span > Girl(< span class = "string" >"girlname"</ span >);< br /> < span class = "comments" >// April 28, 2012, I told you I love you. </ span >< br /> i.love(u);< br /> < span class = "comments" >// but..., what you said that meaning we are still good friends.</ span >< br /> u.sayOtherthing();< br /> < span class = "comments" >// Since then, I ask you for the reason.</ span >< br /> < span class = "keyword" >var</ span > reason=i.ask(u);< br /> < span class = "comments" >// you say we were not understand enough for each other .</ span >< br /> $("body").append(reason);< br /> < span class = "comments" >// You say that it is too quickily to turn our relation of lover.</ span >< br /> < span class = "comments" >// And take care of u and our love.</ span >< br /> i.takeCareOf(u);< br /> < span class = "comments" >// So I keep waiting and I have confidence that you will.</ span >< br /> < span class = "keyword" >boolean</ span > isAccept = < span class = "keyword" >false</ span >;< br /> < span class = "keyword" >while</ span > (isAccept) {< br /> < span class = "placeholder" />i.waitFor(u);< br /> < span class = "placeholder" />< span class = "comments" >// I think it is an important decision</ span >< br /> < span class = "placeholder" />< span class = "comments" >// and you should forgot the unhappy things that happended before.</ span >< br /> < span class = "placeholder" />isAccept = u.thinkOver();< br /> }< br /> < span class = "comments" >// After a please sound of accept, we will live happily ever after.</ span >< br /> u.accept(i);< br /> i.liveHappilyWith(u);< br /> </ div > |
3、js调用方法
1 | document.getElementById( "code" ).typewriter(); |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com