HTML+CSS 中的不确定进度条

发布于 2024-12-06 16:10:10 字数 469 浏览 2 评论 0原文

我想创建一个不确定的 HTML+CSS 进度条,使其看起来像 Vista 上的进度条:

Vista 不确定进度条
(来源:microsoft.com

我会喜欢:

  1. 水平调整进度条宽度(可以定义最小和最大宽度)
  2. 不要使用Javascript,而只是动画GIF,
  3. 在整个宽度上只有一个移动指示器有

什么建议如何做到这一点?

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

Vista indeterminate progress bar
(source: microsoft.com)

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

逆光飞翔i 2024-12-13 16:10:10

不,不,不!这是可能的

使用 CSS overflow:hiddenkeyframe,这是可能的。

对于关键帧,我使用了从 left:-120px(发光对象的宽度)到 left:100%

我使用的结构:

<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>

< s>

使用 :before:after 更新的紧凑结构:

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

渐变、遮罩、发光和所有效果都需要昂贵的结构。如果有人有更好的主意,请告诉我。

目前,仅 webkit 解决方案(发光的椭圆遮罩):

为 Firefox 和其他不支持 -webkit-mask-image 的浏览器添加了 SVG 遮罩 http://jsfiddle.net/danvim/8M24k/

在此处输入图像描述

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/

enter image description here

池予 2024-12-13 16:10:10
  1. css - width:100%
  2. 没有 Javascript 意味着你必须使用 html5 来实现,这有点棘手。 动画 GIF 才会起作用
  3. 仅当您决定将栏设置为固定宽度(否则 gif 将会倾斜)以移动它时,

:javascript 或 html5最简单的方法:javascript(喜欢与否...;))

  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... ;) )

时光与爱终年不遇 2024-12-13 16:10:10

仅 GIF 的解决方案

Vista 的不确定进度条在右侧消失后不会立即循环...
所以我可以创建一个足够宽的 GIF 图像,当进度条变窄时,它需要更长的时间来循环,当它变宽时,它会再次循环。 :)

在两种情况下,每次重复的时间是相同的,但在窄条中,到达终点所需的时间比在宽条中要少。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文