Paywalls allow you to reveal portions of content upon making a payment.
Slide the Money Button to learn how this paywall works.
Welcome to the secret club.
You're free to use the source code in this page.
Here's how to get started:
<div class="money-button">
. Make sure you don't include the <script>
since it is already in the page at the end of the <body>
.data-on-payment
and data-on-error
:data-on-payment="handleSuccessfulPayment" data-on-error="handleFailedPayment"
Here's how this works:
handleSuccessfulPayment(payment)
.unlockContent()
.unlockContent()
adds a CSS class called, unlocked
, to the unlockable
DIV.unlocked
class is defined in CSS to use an animation to transition its opacity.Note: The CSS uses bothopacity
andvisibility
properties becasue the opacity is necessary for the animation and the visibility is necessary for screen readers to skip the locked content.
Drop me a message on Twitter if you use the code so I can applaud your work.