Progress bar layout using CSS and HTML

前端 未结 9 2307
别跟我提以往
别跟我提以往 2020-12-30 01:03

I am trying to achieve UI as shown in the image. However I am having little hard time after trying combinations of positioning now I am clueless. Can someone help me with th

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 01:31

    Just change the onclick function as follows and you will have an animated version of the accepted solution

    $('.changeprogress').click(function() {
      var width = 1;
      var percent = $(this).text().replace('%','') ;
      var id = setInterval(frame, 25);
    
      function frame() {
        if (width >= percent) {
          clearInterval(id);
        } else {
          width++;
          $('.bar').css('width', width + '%');
          $('.percent').text(width + '%');
        }
      }
    
    });
    

    http://jsfiddle.net/Zfzva/418/ can see it here.

    thanks to

    https://stackoverflow.com/a/5865894/2815227

    https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_progressbar_3

提交回复
热议问题