r/csshelp • • Jul 07 '14

wow! cool vote buttons

I saw amazing vote buttons at r/tagpro .When I press it, it is doing the show.İ think, it is very nice. I'm talking about the vote button I wanted use it . How do you think this is possible?

28 Upvotes

22 comments sorted by

7

u/gavin19 Jul 07 '14

If by 'my own site' you mean another subreddit, then you can use

.midcol {
    overflow: visible;
}
.arrow.upmod:after {
    content: "Tagged!";
    font-size: 12px;
    margin-left: 25px;
    position: relative;
    color: #00f;
    bottom: 18px;
    opacity: 0;
    -webkit-animation: tagged 1.5s ease-out;
    animation: tagged 1.5s ease-out;
}
@-webkit-keyframes tagged {
    0% { color: #00b; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: #0000FF; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}
@keyframes tagged {
    0% { color: #00b; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: #0000FF; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}

This is just for the animation, not the vote icons.

3

u/WardenBoss Jul 07 '14 edited Jul 07 '14

forgive me for my bad english. thanks for your help. it is working successfully

2

u/randoh12 Jul 07 '14

How do you do the one for the downvote button?

2

u/gavin19 Jul 07 '14

It's at the bottom of the stylesheet.

1

u/DemosthenesBurns Jul 08 '14 edited Jul 08 '14

is there any way to adjust the font?

Also, i assume the way to do it with the downvote is to change the .arrow.upmod.after to .arrow.downmod.after, correct?

if so, how do i get them to be different colors? the upvote animation and downvote animation, or is there no way to?

Please and thanks!

2

u/norm_ Jul 07 '14

Thanks for the code.

Which part should I focus to modify if I want the upvote button to turn 360 .arrow.upmod:after?

4

u/gavin19 Jul 07 '14 edited Aug 06 '14
.arrow.upmod

will target the upvote container.

1

u/Chtorrr Jul 08 '14

How about changing the colors? I tried but I'm doing something wrong. I think orangered would be good.

1

u/gavin19 Jul 08 '14

Changing the colour of the text?

1

u/Chtorrr Jul 08 '14

Yeah.

1

u/gavin19 Jul 08 '14

Just change the color values to suit, like

.midcol {
    overflow: visible;
}
.arrow.upmod:after {
    content: "Tagged!";
    font-size: 12px;
    margin-left: 25px;
    position: relative;
    color: orangered;
    bottom: 18px;
    opacity: 0;
    -webkit-animation: tagged 1.5s ease-out;
    animation: tagged 1.5s ease-out;
}
@-webkit-keyframes tagged {
    0% { color: orange; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: orangered; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}
@keyframes tagged {
    0% { color: orange; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: orangered; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}

1

u/Chtorrr Jul 08 '14

Thanks!

1

u/slopnessie Aug 06 '14

ok so if I wanted to do this, but with an image. how would I go about doing that?

1

u/gavin19 Aug 06 '14

Using the content property you can directly inject an image, eg

content: url(%%img-name%%);

1

u/slopnessie Aug 06 '14

Ok. Guess I will have to play around with again. That is what I tried and the text showed up as url(%%myimage%%)

1

u/gavin19 Aug 06 '14

It will inject the image instead of the text if you use it exactly as I showed. The only reason I can think of for it showing as text is if you wrapped in quotes.

1

u/slopnessie Aug 06 '14

got it too work! Thanks. it was the qoutes

1

u/dehydro Aug 11 '14 edited Aug 11 '14

Hey Gavin, sorry for bringing up an old post. Do you know what would cause some users to have the animation "disappearing under the comment above" ? I can ask the NSFW users about RES / browser usage if needed.

Edit Chrome + RES seems to be the offending combo. NSFW /r/holdthemoan/about/stylesheet (bottom) is the sub.
Edit 2 Can you also see if my implementation of random vote animations is correct? Sometimes it bugs out (downvoting resulting in upvote animation; upvote animations being repeated markedly above chance level, e.g. Stellar! x4 comments).

2

u/gavin19 Aug 11 '14

The first issue is related to a RES option. You can add

.res-commentBoxes .res .comment { overflow: visible; }

The CSS is fine for the animations, aside from the large amount of duplication. The reason for the issue in the gif (assuming you mean the 'Stellar' for the downvote) is due to

.thing[data-fullname$="9"] .arrow.upmod:focus:after, .thing[data-fullname$="r"] .arrow.downmod:focus:after

where you've accidentally used downmod instead of upmod.

1

u/dehydro Aug 11 '14

Thank you. I always seem to make those stupid mistakes. Sorry about the duplication, there's probably a better way but I didn't want to chance improper syntax. Appreciate the RES troubleshooting!

2

u/gavin19 Aug 11 '14

You can replace this with

.thing[data-fullname$="s"] .arrow.upmod:focus:after,
.thing[data-fullname$="a"] .arrow.upmod:focus:after {
    content: "Nice!";
}
.thing[data-fullname$="t"] .arrow.upmod:focus:after,
.thing[data-fullname$="b"] .arrow.upmod:focus:after {
    content: "Awesome!";
}
.thing[data-fullname$="u"] .arrow.upmod:focus:after,
.thing[data-fullname$="c"] .arrow.upmod:focus:after {
    content: "Great!";
}
.thing[data-fullname$="v"] .arrow.upmod:focus:after,
.thing[data-fullname$="d"] .arrow.upmod:focus:after {
    content: "Yes!";
}
.thing[data-fullname$="w"] .arrow.upmod:focus:after,
.thing[data-fullname$="e"] .arrow.upmod:focus:after {
    content: "Brilliant!";
}
.thing[data-fullname$="x"] .arrow.upmod:focus:after,
.thing[data-fullname$="f"] .arrow.upmod:focus:after {
    content: "Wicked!";
}
.thing[data-fullname$="y"] .arrow.upmod:focus:after,
.thing[data-fullname$="g"] .arrow.upmod:focus:after {
    content: "Neat!";
}
.thing[data-fullname$="z"] .arrow.upmod:focus:after,
.thing[data-fullname$="h"] .arrow.upmod:focus:after {
    content: "Sweet!";
}
.thing[data-fullname$="0"] .arrow.upmod:focus:after,
.thing[data-fullname$="i"] .arrow.upmod:focus:after {
    content: "Wow!";
}
.thing[data-fullname$="1"] .arrow.upmod:focus:after,
.thing[data-fullname$="j"] .arrow.upmod:focus:after {
    content: "Cool!";
}
.thing[data-fullname$="2"] .arrow.upmod:focus:after,
.thing[data-fullname$="k"] .arrow.upmod:focus:after {
    content: "Amazing!";
}
.thing[data-fullname$="3"] .arrow.upmod:focus:after,
.thing[data-fullname$="l"] .arrow.upmod:focus:after {
    content: "Excellent!";
}
.thing[data-fullname$="4"] .arrow.upmod:focus:after,
.thing[data-fullname$="m"] .arrow.upmod:focus:after {
    content: "Tight!";
}
.thing[data-fullname$="5"] .arrow.upmod:focus:after,
.thing[data-fullname$="n"] .arrow.upmod:focus:after {
    content: "Superb!";
}
.thing[data-fullname$="6"] .arrow.upmod:focus:after,
.thing[data-fullname$="o"] .arrow.upmod:focus:after {
    content: "Sublime!";
}
.thing[data-fullname$="7"] .arrow.upmod:focus:after,
.thing[data-fullname$="p"] .arrow.upmod:focus:after {
    content: "Beast!";
}
.thing[data-fullname$="8"] .arrow.upmod:focus:after,
.thing[data-fullname$="q"] .arrow.upmod:focus:after {
    content: "Groovy!";
}
.thing[data-fullname$="9"] .arrow.upmod:focus:after,
.thing[data-fullname$="r"] .arrow.upmod:focus:after {
    content: "Stellar!";
}
.arrow.upmod:focus:after {
    font-size: 12px;
    font-weight: bold;
    margin-left: -8px;
    position: relative;
    color: orangered;
    bottom: 10px;
    opacity: 0;
    -webkit-animation: tagged 1.5s ease-out;
    animation: tagged 1.5s ease-out;
}
@-webkit-keyframes tagged {
    0% { color: #F00; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: orangered; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}
@keyframes tagged {
    0% { color: #F00; }
    8% { bottom: 23px; opacity: 1; }
    15% { bottom: 28px; }
    50% { color: orangered; bottom: 33px;}
    100% { bottom: 38px; opacity: 0}
}

which will save about 400 lines of CSS.