有没有办法在 HTML 表格上自定义选取框以减少滚动延迟?

质量

我从 API 获取数据,我想将其显示在表格上。但是,此表具有选框滚动功能。

内容应显示在示例代码中。这很好用。

挑战是scroll delay,我想显示记录,然后延迟 3 秒,然后再次开始循环。

目前,延迟在大约 80 秒后开始,猜猜这是默认设置吗?

等等,我知道选框已被弃用,但是,它适用于这种情况。

有谁知道该怎么做?

var response = [
{
"collected_received": 805,
"tested": 526,
"perc_less_1000": 0.8768267,
"rejected": 1
},
{
"collected_received": 788,
"tested": 1933,
"perc_less_1000": 0.9077469,
"rejected": 0
},
{
"collected_received": 114,
"tested": 2342,
"perc_less_1000": 0.9503951,
"rejected": 16
},
{
"collected_received": 492,
"tested": 767,
"perc_less_1000": 0.8912732,
"rejected": 7
},
{
"collected_received": 186,
"tested": 909,
"perc_less_1000": 0.9170404,
"rejected": 1
},
{
"collected_received": 115,
"tested": 378,
"perc_less_1000": 0.931694,
"rejected": 1
},
{
"collected_received": 26,
"tested": 368,
"perc_less_1000": 0.9466292,
"rejected": 0
}
];


var trHTML = '';

$.each(response, function (i, item) {

trHTML += '<tr><td width="130px"><div style="width: 35px;border-radius: 0.1vw; text-align:center; border: 0.1vw rgba(255,255,255,.7) solid;font-size: 0.8em; margin: 0.1vw; padding:0px 0px 0px 0px;">' + item.collected_received + '</div></td><td width="90px"><div style="width: 35px;border-radius: 0.1vw;text-align:center; border: 0.1vw rgba(255,255,255,.7) solid;font-size: 0.8em; margin: 0.1vw; padding:0px 0px 0px 0px;">' + item.tested + '</div></td><td width="130px"><div style="width: 35px;border-radius: 0.1vw;text-align:center; border: 0.1vw rgba(255,255,255,.7) solid;font-size: 0.8em; margin: 0.1vw; padding:0px 0px 0px 0px;">' + item.perc_less_1000.toFixed(1) + '</div></td><td width="90px"><div style="width: 35px;border-radius: 0.1vw;text-align:center; border: 0.1vw rgba(255,255,255,.7) solid;font-size: 0.8em; margin: 0.1vw; padding:0px 0px 0px 0px;">' + item.rejected + '</div></td></tr>';

});
$('#records_table').append(trHTML);
.marquee {
    top: 6em;
    position: relative;
    box-sizing: border-box;
    animation: marquee 140s linear 0s infinite;
}

.marquee:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        top: 40em
    }
    100% {
        top: -300em
    }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="row contain"
   style="background-color: rgba(0,0,0,.15); margin:2px; height:150vh; max-height:94vh;border-radius: 0.9vw;">
   <div class="table-responsive">
      <table class="table table-condensed table-striped table-sm" style="color: white;"
         id="table_fixed">
         <thead>
            <tr>
               <th width="130px">Received</th>
               <th width="90px"> Tested </th>
               <th width="130px">Total (%)</th>
               <th width="90px">Rejected </th>
            </tr>
         </thead>
      </table>
   </div>
   <div class="table-responsive" id="contain">
      <table class="marquee table table-condensed table-striped table-sm" style="color: white;truespeed:10;"
         id="records_table">
         <tbody>
         </tbody>
      </table>
   </div>

维沙尔·P·哥特

实际上,没有选项可以设置下一次迭代的延迟,但是我们可以通过 CSS 中的小改动来管理它,如下所示,请尝试使用这个 CSS

.marquee {
    top: 6em;
    position: relative;
    box-sizing: border-box;
    animation: marquee 20s linear 0s infinite;

}

.marquee:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        top: 30em;
    }
    100% {
        top: -30em;
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

有没有办法使用 IntegerField 设置自定义 html 步骤?

有没有办法使用 HTML 和 CSS 在 SVG 路径上制作滚动字幕?

有没有办法禁用某些HTML锚点的jQuery滚动动画?

有没有办法制作包含其他标签的自定义HTML标签?

Azure blob 存储:当文件的 SAS 令牌过期时,有没有办法显示自定义 html 页面?

有没有办法在没有文本框的情况下用Javascript / HTML输入文本?

有没有办法让HTML元素溢出:滚动DIV始终保持在其他元素之上?

有没有办法在不使用变量的情况下在 vanilla Javascript 中定义 HTML ID?

有没有办法在没有 SVG 的情况下仅在边框上制作带有指针事件的 HTML 框?

有没有办法使HTML可重用块?

有没有办法使div渲染从右到左HTML

有没有办法从 Ruby 渲染 HTML 页面?

有没有办法在html中触发事件

有没有办法从 JavaScript 导入 .html 文件?

有没有办法减少多个类型的参数?

有没有办法在Firebase中减少请求?

有没有办法减少句子间距?

有没有办法减少这种情况?

有没有办法减少重复?

有没有办法减少 IF 语句的数量?

有没有办法减少这个带宽?

有没有办法增加Intellisense的弹出延迟?

有没有办法关闭延迟加载?

有没有办法操纵延迟堆栈?

有没有办法抵消或延迟li动画?

有没有办法在JQuery中延迟mouseleave?

有没有办法从 Lazyrow 获取滚动状态

有没有办法使水平滚动更流畅

有没有办法阻止 UIDatePicker 滚动/旋转?