Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello! I'm new to this module, so if this issue has already been addressed, please help me find the relevant topic. I wasn't able to find one.
I'm using the Thumbs Up widget on a project, and the thumb appears orange both before and after it's clicked, even though there's a gray thumb in the same image file/sprite. Is there already a way to get the thumb to start out gray and turn orange when the user has voted?
If there's not already a way, I'll be happy to take it on, but I don't want to reinvent the wheel. Thank you!
Comments
Comment #1
BenStallings CreditAttribution: BenStallings commentedComment #2
BenStallings CreditAttribution: BenStallings commentedOK, this is probably not the correct way to go about this, but it's the way I found.
First, I changed the thumbs-up.css file to read
That is, by default the widget has its background offset by 25 pixels, to display the gray thumb, but when the .rate-thumbs-up-btn-clicked class is added, the background is returned to the zero position to display the orange thumb.
Next I added the following to rate.js just above the click function:
There are a couple of glaring problems with this solution: it won't work in languages other than English, and it may interfere with other widgets. I'm eager to hear how I should have done it instead. Thanks!
Comment #3
BenStallings CreditAttribution: BenStallings commentedComment #4
lwwalker CreditAttribution: lwwalker commentedNice. Thanks for updating with your fix, I was having the exact same problem. Your fix works fine so far for me.
Comment #5
mr.andrey CreditAttribution: mr.andrey commentedSubscribing. It would be nice to have this working out of the box with translations and all. Thanks!
Comment #6
Time has come CreditAttribution: Time has come commentedThe Thumbs Up Thumbs Down also has the same issue - button state doesn't change on voting.
I think I've found a CSS fix.
I replaced these over rode these styles via my theme's custom.css.
to
and
to
Not sure if this is the right way to achieve it but works for me.