Last active
December 26, 2015 22:39
-
-
Save jesseshowalter/7224531 to your computer and use it in GitHub Desktop.
My first Gist, learning how to use this so I can embed code on my site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav> | |
<a class="brand" href="../../index.html"><h1>Jesse Showalter</h1></a> | |
<span>Jesse Showalter - EST.1984</span> | |
<ul> | |
<li><a href="../../about.html">Info</a></li> | |
<li><a href="../../articles/index.html">Articles</a></li> | |
<li><a href="../../contact.html">Contact</a></li> | |
</ul> | |
</nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For the tags content drawer | |
$(document).ready(function(){ | |
$('.content-drawer').hide(); | |
$('.tab').click(function() { | |
var $this = $(this); | |
var target = $(this.rel); | |
$this.closest('li').addClass('active focus'); | |
// Add the classes to the closest li of the clicked anchor | |
$('.tab').not($this).closest('li').removeClass('active focus'); | |
// Remove the classes for the non-clicked items | |
$('.content-drawer').not(target).slideUp(); | |
// Slideup the other contents | |
target.delay(200).slideToggle(); | |
// Toggle the current content | |
if (target.is(':visible')) { | |
// Only if the target is visible remove the active class | |
$this.closest('li').removeClass('active'); | |
} | |
return false; | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment