4

我使用这个插件:http ://www.fyneworks.com/jquery/star-rating

它包含一个star.gif(实际上包含三种不同颜色的星星)并且它只在包含的css文件中引用这个gif一次:

div.star-rating,div.star-rating a{background:url(star.gif) no-repeat 0 0px}

我不想再使用star.gif,而是使用我自己的png格式的图像。我怎样才能做到这一点?

我想会有三种选择:

  1. 创建我自己的 myGif.gif 并在 jquery-rating CSS 中引用它(我不想要,因为我想使用我的 .png-Images 并且我不太了解 gif 并且不知道如何创建一个包含多个图像的图像)

  2. 将 CSS-File 更改为它引用我的 .png-Images (这里的问题是 gif 包含三种不同颜色的星星,但 png 只包含一个图像,所以星星的颜色不会再改变)

  3. 也许更改 Jquery-Rating Javascript 文件,以便它自动包含我的 pngs?

你会推荐什么?怎么做?

4

3 回答 3

2

这似乎很基本。只需更改 css 文件以指向您的图像。这确实是唯一有意义的解决方案。

于 2010-11-03T16:18:50.547 回答
1

All you have to do is change the background image of the DIVs and As created by the plugin, like this:

div.star-rating, div.star-rating a{
    background-image:url('/path/to/your/green-stars.gif');
}

Here is an example we made: http://jsfiddle.net/tLuqJ/1/

And here is the original image you can use as the basis to make your own colours: http://jquery-star-rating-plugin.googlecode.com/svn/trunk/star.gif

于 2014-05-03T08:59:44.283 回答
-1

在您自己的 css 文件中覆盖它:

 div.star-rating,div.star-rating a{
    background:url(myimg.png) no-repeat 0 0px !important;
 }
于 2010-11-03T16:18:03.807 回答