博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JQuery进度条
阅读量:7199 次
发布时间:2019-06-29

本文共 593 字,大约阅读时间需要 1 分钟。

需要实现效果如下图。

页面代码 
第一次进入页面调用。或每次赋值或更改值时调用方法 function updataProgressBar(){ //更新进度条信息

  //进度条设置

  var $color=$('.progress_bar').attr('data-color');  //data-color 为进度条颜色 例#ff6600
  $('.progress_bar').each(function () {
  var per=$(this).attr('data-per');             //data-per 为进度条 进度值 1-100
  var barWidth=$(this).attr('data-width');         //data-width 为进度条宽度 值自定义 单位自动填充px
  $(this)
  .find('span').css({'background' : $color , 'width' : per + '%'})
  .parent().css({'width' : barWidth})
  .next().text(per+'%');
  })
}

 

 

转载于:https://www.cnblogs.com/zhan1995/p/8708404.html

你可能感兴趣的文章