doublesecretagency / craft-upvote

Upvote plugin for Craft CMS
Other
15 stars 6 forks source link

Add an "Is Ready" class once javascript loads #37

Open brettburwell opened 2 years ago

brettburwell commented 2 years ago

Howdy duder.

This plugin is nifty! One thing I'd like to do is fade / animate the vote count into place (vs. it suddenly popping into place once the javascript is loaded and it's injected into the page).

Would it be possible to add a class we could use as a styling hook? Something like .is-ready or .upvote-total-upvotes-ready?

And forgive me if there's already a simple way to do this that I'm just overlooking.

Thanks in advance.

lindseydiloreto commented 2 years ago

Hey dude! 🍺

There are a few classes that are automatically added already, not sure if they are something that you can use. More specifically, the upvote-vote-match class gets added to every upvote/downvote icon after the vote has been cast.

The docs don't go into great detail about it, but here is the relevant page...

https://plugins.doublesecretagency.com/upvote/customize-your-css/#css-classes

Hope that helps! If not, feel free to DM me on Discord and we can chat about what might be possible.

lindseydiloreto commented 2 years ago

After chatting on Discord, it sounds there's currently no good workaround. The number itself doesn't have any classes that change when a vote is cast.

So let's create a new class (ie: upvote-voted) which will be dynamically added to the number (and possibly arrows) of an element when a vote is cast.

Thanks for the suggestion @brettburwell! I'm not sure exactly when this will get implemented, but I'll try to work it into the next major round of changes. 👍

brettburwell commented 2 years ago

Thanks again @lindseydiloreto!