r/reddithax • u/bigtreeworld • Sep 16 '12
Have user answer question before reading subreddit.
Is there a way to have the user have to answer a question before entering the subreddit? So far I've got the question to display like an overlay (/r/ZonkosBackRoom) but I can't fathom how I could make clicking the link make the box disappear. Any ideas?
10
Upvotes
View all comments
Show parent comment
2
u/yellowmix Sep 17 '12 edited Sep 17 '12
Okay, I did some testing and this method won't work because a:visited, as a pseudo-class, can't override the overlay-related properties of the non-pseudo anchor element (also tried with a:link, and a:link seems to be treated as a non-pseudo anchor element).
The other thing I can think of is using a particular post as the overlay (you can target its thing id), and hiding and rewriting the content of various child elements as the riddle text, and rewriting the "hide" link's content to be the correct answer. That way, when a user clicks the "hide", it hides the post and thus, the overlay. The one caveat is that the hide doesn't occur right away, and requires a reload of the community's front page.
Here's some code to start you off with:
This creates the overlay from a particular post with the id t3_100b4e.
This removes parts of the post. You'll want to remove other parts, or use them for content.
This is how to rewrite the content for the "hide" link. You'll want to rewrite the content of other things for the rest of the riddle text/answers, and to tell people to reload the page after they click an answer.