Skip to content

Instantly share code, notes, and snippets.

@lgedeon
Created December 5, 2013 18:24
Show Gist options
  • Save lgedeon/7810594 to your computer and use it in GitHub Desktop.
Save lgedeon/7810594 to your computer and use it in GitHub Desktop.
Basic toggling
<div id="container">
<h1>Hello
<span class="seoslides-vistoggler">
<a href="#">Trigger</a>
<span>hide me</span>
</span> world
</h1>
The trigger can be a link, button, or anything else as long as it isn't in a span :)
</div>
<style>
.seoslides-vistoggler span {
margin: 0 20px;
padding: 10px;
background: #cef;
display: none;
}
.seoslides-vistoggler a {
font-size: .2em;
vertical-align: super
}
</style>
<script>
jQuery("#container").on( "click", ".seoslides-vistoggler", function(event) {
event.preventDefault();
jQuery( this ).find( "span" ).toggle( "slow");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment