Indeterminate progress bar in HTML+CSS

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

I would like to create an indeterminate HTML+CSS progress bar so it looks like the one on Vista:

Vista indeterminate progress bar http://i.msdn.microsoft.com/dynimg/IC121865.png

I would like to:

  1. horizontally adjust it to progress bar width (minimum and maximum width may be defined)
  2. don't use Javascript but rather just animated GIF
  3. having only one moving indicator on the whole width

Any suggestions how to do this?

回答1:

  1. css - width:100%
  2. no Javascript means you will have to do it with html5 which is a bit trickier. An animated GIF would work only if you decide to make the bar fixed-width (otherwise the gif will be skewed)
  3. to move it: javascript or html5

The easiest way: javascript (like it or not... ;) )



回答2:

NO, NO, NO! It is possible

Using CSS overflow: hidden and keyframe, it can be possible.

For the keyframe, I used from left:-120px(width of the glowing object) to left:100%

The structure I used:

<div class="loader"> <div class="loader-bg left"></div> <div class="loader-bg right"></div> <div class="greenlight"></div> <div class="gloss"></div> <div class="glow"></div> </div> 

The updated, compact structure using :before and :after:

<div class="loader7">     <span></span>     <div class="greenlight"></div> </div> 

The gradient, masking, glowing and all the effects cost an expensive structure. If anyone has a better idea, please let me know.

At this date, webkit only solution(the ellipse mask for the glow):

Added SVG mask for Firefox and other browsers that do not support -webkit-mask-image: http://jsfiddle.net/danvim/8M24k/



回答3:

GIF-only solution

Vista's indeterminate progress bar doesn't loop right after it goes off on the right... So I could create a wide enough GIF image and when progress bar would be narrow it would take longer for it to loop and when it'd be wider it loops again sonner. :)

Time of each repeat is the same in both cases but in narrow bar it takes less to get to the end than on the wider ones.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!