国产69囗曝吞精在线视频,肥臀浪妇太爽了快点再快点,亚洲欧洲成人a∨在线观看,狠狠色丁香久久综合 ,国精一二二产品无人区免费应用,亚洲精品久久久久中文字幕,四虎一区二区成人免费影院网址 ,无码三级中文字幕在线观看

      Javascrpit之打字機效果

      2018-6-25    seo達人

      如果您想訂閱本博客內(nèi)容,每天自動發(fā)到您的郵箱中, 請點這里

      今天來看看怎么實現(xiàn)炫酷的打字機效果。即把一段話一個字一個字的顯示出來。

      效果圖:

      實現(xiàn)思路:

      首先規(guī)定好顯示字數(shù)的速度即settimeout執(zhí)行間隔用來控制每個字之間輸出速度。再把判斷段落的總字數(shù),循環(huán)段落總字數(shù)來實現(xiàn)一個字一個字的輸出。

      js代碼:

      
          
      1. var theNewsNum;
      2. var theAddNum;
      3. var totalNum;
      4. var CurrentPosion=0;
      5. var theCurrentNews;
      6. var theCurrentLength;
      7. var theNewsText;
      8. var theTargetLink;
      9. var theCharacterTimeout;
      10. var theNewsTimeout;
      11. var theBrowserVersion;
      12. var theWidgetOne;
      13. var theWidgetTwo;
      14. var theSpaceFiller;
      15. var theLeadString;
      16. var theNewsState;
      17. function startTicker(){
      18. // ------ 設置初始數(shù)值
      19. theCharacterTimeout = 50;//字符間隔時間
      20. theNewsTimeout = 2000;//新聞間隔時間
      21. theWidgetOne = "_";//新聞前面下標符1
      22. theWidgetTwo = "-";//新聞前面下標符
      23. theNewsState = 1;
      24. theNewsNum = document.getElementById("incoming").children.AllNews.children.length;//新聞總條數(shù)
      25. theAddNum = document.getElementById("incoming").children.AddNews.children.length;//補充條數(shù)
      26. totalNum =theNewsNum+theAddNum;
      27. theCurrentNews = 0;
      28. theCurrentLength = 0;
      29. theLeadString = " ";
      30. theSpaceFiller = " ";
      31. runTheTicker();
      32. }
      33. // --- 基礎函數(shù)
      34. function runTheTicker(){
      35. if(theNewsState == 1){
      36. if(CurrentPosion<theNewsNum){
      37. setupNextNews();
      38. }
      39. else{
      40. setupAddNews();
      41. }
      42. CurrentPosion++;
      43. if(CurrentPosion>=totalNum||CurrentPosion>=1){
      44. CurrentPosion=0;//最多條數(shù)不超過num_gun條
      45. }
      46. }
      47. if(theCurrentLength != theNewsText.length){
      48. drawNews();
      49. }
      50. else{
      51. closeOutNews();
      52. }
      53. }
      54. // --- 跳轉(zhuǎn)下一條新聞
      55. function setupNextNews(){
      56. theNewsState = 0;
      57. theCurrentNews = theCurrentNews % theNewsNum;
      58. theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText;
      59. theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href;
      60. theCurrentLength = 0;
      61. document.all.hottext.href = theTargetLink;
      62. theCurrentNews++;
      63. }
      64. function setupAddNews() {
      65. theNewsState = 0;
      66. theCurrentNews = theCurrentNews % theAddNum;
      67. theNewsText = document.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText;
      68. theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.Summary.children[0].href;
      69. theCurrentLength = 0;
      70. document.all.hottext.href = theTargetLink;
      71. theCurrentNews++;
      72. }
      73. // --- 滾動新聞
      74. function drawNews(){
      75. var myWidget;
      76. if((theCurrentLength % 2) == 1){
      77. myWidget = theWidgetOne;
      78. }
      79. else{
      80. myWidget = theWidgetTwo;
      81. }
      82. document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
      83. theCurrentLength++;
      84. setTimeout("runTheTicker()", theCharacterTimeout);
      85. }
      86. // --- 結(jié)束新聞循環(huán)
      87. function closeOutNews(){
      88. document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
      89. theNewsState = 1;
      90. setTimeout("runTheTicker()", theNewsTimeout);
      91. }
      92. window.onload=startTicker;
      藍藍設計www.izc.net.cn )是一家專注而深入的界面設計公司,為期望卓越的國內(nèi)外企業(yè)提供卓越的UI界面設計、BS界面設計 、 cs界面設計 、 ipad界面設計 、 包裝設計 、 圖標定制 、 用戶體驗 、交互設計、 網(wǎng)站建設 平面設計服務

      日歷

      鏈接

      個人資料

      藍藍設計的小編 http://www.izc.net.cn

      存檔

      主站蜘蛛池模板: 国产又黄又大又粗视频| 国产青草| 色污网站| 国产日韩精品中文字无码| 九九久久精品| 国产精品va无码一区二区三区| 国产三区在线成人av| 精品无码专区亚洲| 北岛玲在线| 久久久片| 中文日韩亚洲欧美字幕| 无码一卡二卡三卡四卡| 国产一区视频在线| 中文字幕xxxx| 色综合久久中文综合网| 偷窥xxxx盗摄国产| 日韩一区二| 伊人成综合| 久久国产精品久久久久久| 国产精品午夜福利麻豆| 中文字幕人妻丝袜乱一区三区| 天天摸天天舔| 国产真实乱子伦精品视频| 无码人妻丝袜在线视频| 日韩毛片av| av导航网| 亚洲成aⅴ人片久青草影院| 国产av久久人人澡人人爱| 欧美一区二区三区免费| 欧美成人黄色片| 国产亚洲日本精品无码| 真实单亲乱l仑对白视频| 久久黄色录像| 日本老熟妇乱| 国产精品久久久久久| 国产高清在线男人的天堂| 蓝牛av| www日韩精品| 麻豆md0077饥渴少妇| 亚洲精品第一国产综合麻豆| 高h大肚孕期孕妇play|