如何创建进度“栏”类似于 Groovshark?

发布于 2024-10-07 15:37:01 字数 288 浏览 1 评论 0原文

我很好奇...我该如何创建一个像 Grooveshark 以前那样的自定义进度条?如果您查看下图,您会发现进度条是鲨鱼形状的图像,并在页面加载时填充。

Grooveshark Progress Bar

我认为这非常酷,并且很想知道它是如何完成的。这可以通过编程方式完成,还是在闪存中完成?如果可能的话,我真的很想用 JavaScript (jQuery) 来做到这一点。我从哪里开始/如何开始?

谢谢, 赫里斯托

I'm curious... how would I go about creating a custom progress bar like the one Grooveshark used to have? If you look at the image below, the progress bar is an image in the shape of a shark and fills in as the page loads.

Grooveshark Progress Bar

I think this is very cool and would love to know how it is done. Can this be done programmatically, or is it done in flash? I would really like to do this in JavaScript (jQuery) if it is possible. Where/How do I start?

Thanks,
Hristo

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

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

发布评论

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

评论(1

半城柳色半声笛 2024-10-14 15:37:01

图像中包含鲨鱼的部分可以是剪掉鲨鱼形状的 PNG。在其下方放置一个元素(通过 z-index),并对它的宽度进行动画处理,会给人一种鲨鱼填充的印象。

我成功地只使用图像来完成类似的事情,并对其背景图像进行动画处理:< a href="http://jsbin.com/imibe3">http://jsbin.com/imibe3

HTML

<img src="http://sampsonresume.com/labs/emptyfish.png" class="fish" />

CSS

img.fish { 
  background-color:#f1f1f1; 
  background-image:url(water_640x480.jpg);
  background-position:-580px 0;
  background-repeat:no-repeat;
}

jQuery/Javascript

$("img.fish").animate( { 'backgroundPosition':'+=600px 0' }, 10000);​

The portion of the image containing the shark could be a PNG with the shark shape cut out. Placing an element just beneath this (via z-index), and animating the width of it it will give the impression of the shark filling in.

I managed to accomplish something similar using nothing more than an image, and animating its background image: http://jsbin.com/imibe3

HTML

<img src="http://sampsonresume.com/labs/emptyfish.png" class="fish" />

CSS

img.fish { 
  background-color:#f1f1f1; 
  background-image:url(water_640x480.jpg);
  background-position:-580px 0;
  background-repeat:no-repeat;
}

jQuery/Javascript

$("img.fish").animate( { 'backgroundPosition':'+=600px 0' }, 10000);​
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文