【问题标题】:Use the value of an ID to start a countdown使用 ID 的值开始倒计时
【发布时间】:2020-05-28 18:45:33
【问题描述】:

I have a circular progress bar where the user can select the time for a countdown, when the time is chosen the value is saved in an ID but I cannot get this countdown to start from that ID

<script>
    $(document).ready(function() {
      $('.dial').knob({
        'min':0,
        'max':20,
        'width':250,
        'height':250,
        'displayInput':true,
        'fgColor':"#e74c3c",
        'pColor' :"FFA491",


        'release':function(v) {
            document.getElementById('v').innerHTML = v;
        },
   });
    });
  </script>

在发布时记录该值,然后转换为ID“v”

我已经在这个页面上传了结果:https://juanmannnuel.neocities.org/

【问题讨论】:

  • 嗨胡安!您能否提供更多上下文,最好是 codepen 或 jsfiddle 中的一个孤立示例?
  • 抱歉,我发现上传它的唯一方法是在新城市

标签: javascript html jquery countdown


【解决方案1】:

如果你想让它倒计时,它看起来像。

  $('.dial').knob({
    'min':0,
    'max':20,
    'width':250,
    'height':250,
    'displayInput':true,
    'fgColor':"#e74c3c",
    'pColor' :"FFA491",


    'release':function(v) {
        document.getElementById('v').innerHTML = v;
        $('.dial').val(v).trigger("blur");
    },
   });

你可以试一试吗?

这是一个带有倒计时的更新小提琴。 https://codepen.io/mitkodeli/pen/KKdjQyN

【讨论】:

  • 对不起,我觉得我没有表达好,我想要的是让用户决定循环进度条中的秒数。倒计时开始后,但数字不带栏。
  • 你能检查一下这是否是你要找的结果吗? codepen.io/mitkodeli/pen/KKdjQyN
  • 在我的代码中稍作调整后,我取得了不错的成绩。这不是我最初想要的,但它仍然对我有用,非常感谢;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多