Sidejar
Docs menu

Reveal effects

A reveal effect obscures exposed content until it's paid, then reveals it, often with an animation. fade suits a preview before an encrypted rest; the others obscure the words, so they're for content that's all in the page:

<sidejar-content for="tip" effect="scramble">
  <p>Your content, in the page…</p>
</sidejar-content>
Effect Before payment When paid
scramble Every letter randomized, same shape (the same gibberish on every visit) Descrambles into the real words, left to right
redact Phrases blacked out in solid bars, every fourth word left readable. Each bar is a <span class="sidejar-redacted"> you can style The bars peel open, left to right
sort-words Each sentence's words in alphabetical order They fall back into place, left to right
sort-letters Each word's letters in alphabetical order (wallet → aellltw) The words unsort, left to right
flip Upside down: each letter flipped, each line reversed (ʇxǝʇ) Turns right side up, left to right
blur Blurred Comes into focus
fade The top part, fading out Expands to full height
hide Hidden Shown

A returning payer sees everything right away, without the animation, and animations respect the "reduce motion" setting. While it animates, the element is in the sidejar-unlocking state. While locked, obscured content is hidden from screen readers, which hear "Locked content" instead.

Restyling redact: the bars take the text's color, so they suit light and dark pages. To change them:

.sidejar-redacted { background-color: #fde047; border-radius: 0; } /* a highlighter look */

Your own effect: name a function on your page. It's called with the <sidejar-content> element, "locked" or "unlocked", and { animate } (false for a returning payer), and can make any CSS or JavaScript change. Return a Promise to keep the element sidejar-unlocking until your animation ends. If the name isn't a built-in or a function, or it throws, the element fires content_handler_failed. The built-ins are available as Sidejar.effects to build on.

<script>
  function spin(el, state) {
    el.style.transition = "transform 700ms ease";
    el.style.transform = state === "locked" ? "rotate(180deg)" : "none";
  }
</script>
<sidejar-content for="tip" effect="spin">…</sidejar-content>

Reveal effects are not encryption. The content is in your page's source, so anyone determined can read it, and so can search engines. That's the point. If you hide text from readers but show it to search engines, add Google's paywalled-content markup (isAccessibleForFree: false) so it isn't treated as cloaking. See the demos, or try them in the reveal effects tool.