当前位置:   article > 正文

简单的投屏、数据大屏前端代码_js 电脑投屏到显示屏代码

js 电脑投屏到显示屏代码

大厅投屏显示表格数据,无缝滚动,数据30分钟刷新一次(自己设置,用定时器刷新ajax)

页面样式:

效果展示:http://www.zjhuiwan.cn/blogImg/upload/ueditorVideo/20201118/160568355027930009717.mp4

页面代码

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="refresh" content="1800" />
  6. <title></title>
  7. <style type="text/css">
  8. *{margin: 0;padding: 0;list-style: none;text-decoration: none;font-family: "微软雅黑";box-sizing: border-box;}
  9. .content{width: 1920px;height: 1080px;background: url(img/bg.png) no-repeat top left;padding: 0 55px;}
  10. .itemList{text-align: center;}
  11. .item{overflow: hidden;display: inline-block;margin-right: 75px;}
  12. .item:last-child{margin-right: 0;}
  13. .item img{float: left;}
  14. .item div{float: right;text-align: left;}
  15. .item div p{color: #a7fef8;font-size: 24px;}
  16. .item div span{color: #00fcff;font-size: 24px;}
  17. .date{color: #11eef6;font-size: 24px;margin-bottom: 30px;padding-left: 10px;}
  18. .listBG{background: url(img/bg2.png) no-repeat top left; width: 100%;height: 760px;padding: 0 55px;}
  19. .ul{padding-top: 20px;}
  20. .li{color: #fff;font-size: 24px;height: 65px;line-height: 65px;overflow: hidden;}
  21. .li:nth-child(2n){background: #0e235e;}
  22. .li div{float: left;width: 26%;text-align: center;}
  23. .li div:first-child{width: 15%;margin-right: 6%;}
  24. </style>
  25. </head>
  26. <body>
  27. <div class="content">
  28. <div style="width: 100%;height: 140px;"></div>
  29. <div class="itemList">
  30. <div class="item">
  31. <img src="img/1 (1).png"/>
  32. <div>
  33. <p>今日完成量(张)</p>
  34. <span id="daynum"></span>
  35. </div>
  36. </div>
  37. <div class="item">
  38. <img src="img/1 (2).png"/>
  39. <div>
  40. <p>本月完成量(张)</p>
  41. <span id="monthnum"></span>
  42. </div>
  43. </div>
  44. <div class="item">
  45. <img src="img/1 (3).png"/>
  46. <div>
  47. <p>本年完成量(张)</p>
  48. <span id="yearnum"></span>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="date"><span id="now"></span>排行</div>
  53. <div class="listBG">
  54. <div class="ul">
  55. <div class="li" style="color: #4dbdff;"><div>序号</div><div>员工工号</div><div>员工姓名</div><div>完成量</div></div>
  56. <div id="ul" style="overflow:hidden;height:645px">
  57. <div id ="showinfo" >
  58. </div>
  59. <div id ="showinfo2" ></div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </body>
  65. <script src="js/jquery-1.7.2.js"></script>
  66. <script type="text/javascript">
  67. $.ajax({
  68. url: 'http://localhost:8080/jjc_war_exploded/cardRecord/getRecordList.do',
  69. type: "GET",
  70. dataType: "json",
  71. async: true,
  72. success: function(data){
  73. console.log(data);
  74. var str = '';
  75. var i = 1;
  76. $.each(data.dataList,function(index,element){
  77. str += '<div class="li"><div>'+i+'</div><div>'+element.number+'</div><div>'+element.name+'</div><div>'+element.overnum+'</div></div>';
  78. i++;
  79. })
  80. $('#showinfo').html(str);
  81. $('#daynum').text(data.daynum);
  82. $('#monthnum').text(data.monthnum);
  83. $('#yearnum').text(data.yearnum);
  84. $('#now').text(data.now);
  85. if(i>10){
  86. window.onload = roll(50);
  87. }
  88. }
  89. })
  90. // 传入的 t 为滚动快慢的时间
  91. function roll(t) {
  92. let ul1 = document.getElementById("showinfo");
  93. let ul2 = document.getElementById("showinfo2");
  94. let box = document.getElementById("ul");
  95. ul2.innerHTML = ul1.innerHTML;
  96. // 初始化滚动高度
  97. box.scrollTop = 0;
  98. let timer = setInterval(function(){
  99. console.log(box.scrollTop+"_____"+ul1.scrollHeight);
  100. if (box.scrollTop >= ul1.scrollHeight) {
  101. box.scrollTop = 0;
  102. } else {
  103. box.scrollTop++;
  104. }
  105. }, t);
  106. box.onmouseover = function () {
  107. clearInterval(timer)
  108. }
  109. box.onmouseout = function () {
  110. timer = setInterval(function(){
  111. if (box.scrollTop >= ul1.scrollHeight) {
  112. box.scrollTop = 0;
  113. } else {
  114. box.scrollTop++;
  115. }
  116. }, t);
  117. }
  118. }
  119. </script>
  120. </html>

查看我的个人博客:ZJBLOG

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/743047
推荐阅读
相关标签
  

闽ICP备14008679号