Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add page to CrowdfundHQ using hash in URL
<div class="normal">
<h3>Normal content</h3>
<p>This is what the user normally sees</p>
<a href="/test/liquid#invite">Invite</a>
</div>
<div class="invite" style="display:none">
<h3>Invite form</h3>
<p>The invite page</p>
<a href="/test/liquid#">Back</a>
</div>
<script>
var normal = document.querySelector('.normal')
var invite = document.querySelector('.invite')
function route () {
var hash = window.location.hash
if (hash === '#invite') {
normal.style.display = 'none'
invite.style.display = 'block'
} else {
normal.style.display = 'block'
invite.style.display = 'none'
}
}
window.addEventListener('hashchange', route)
route()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.