Customizing the Stars Image for Ajaxful_Rating RoR plugin
Posted
by Kevin
on Stack Overflow
See other posts from Stack Overflow
or by Kevin
Published on 2010-06-02T20:29:32Z
Indexed on
2010/06/02
20:34 UTC
Read the original article
Hit count: 239
I'm trying to come up with my own star image that's slightly smaller and different style than the one provided in the gem/plugin, but Ajaxful_rating doesn't have an easy way to do this. Here's what I've figured out so far:
- The stars.png in the public folder is three 25x25 pixel tiles stacked vertically, ordered empty star, normal star, and hover star.
- I'm assuming as long as you keep the above constraints, you should be fine without modifying any other files.
- But what if you want to change the image size of the stars to larger or smaller?
I've found where you can change the height in the stylesheets/ajaxful_rating.css
.ajaxful-rating{ position: relative; /*width: 125px; this is setted dynamically */ height: 25px; overflow: hidden; list-style: none; margin: 0; padding: 0; background-position: left top; }
.ajaxful-rating li{ display: inline; } .ajaxful-rating a, .ajaxful-rating span, .ajaxful-rating .show-value{ position: absolute; top: 0; left: 0; text-indent: -1000em; height: 25px; line-height: 25px; outline: none; overflow: hidden; border: none; }
You just need to change every place that says "25px" above to whatever height your new star image is. This works fine but doesn't display the horizontal part correctly. Anyone know where I would look to set the horizontal part as well? (I'm assuming it's in an .rb file somewhere based upon how many stars you specified in your ajaxful_rating setup)
© Stack Overflow or respective owner