Skip to content

Instantly share code, notes, and snippets.

@jserrao
Created September 16, 2013 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jserrao/6581568 to your computer and use it in GitHub Desktop.
Save jserrao/6581568 to your computer and use it in GitHub Desktop.
Doing an accordion with font icons that fade in/out
<script type="text/javascript">
(function($) {
//hides all older job panels to start and icons
var allPanels = $('.accordion > ul').hide();
var upIcons = $('.icon-circle-arrow-up').hide();
//.toggle function opens panel, switches icon on first click, closes panel, resets icon on second click
$('.accordion > h3 > a').toggle(
function() {
$(this).parent().next().slideDown();
$('.accordion > h3 > a > i.icon-circle-arrow-down').fadeOut(100,
function() {
$('.accordion > h3 > a > i.icon-circle-arrow-up').css('margin-left','0em').fadeIn('100');
});
return false; //keeps page from jumping to top
},
function() {
$(this).parent().next().slideUp();
$('.accordion > h3 > a > i.icon-circle-arrow-up').fadeOut(100,
function() {
$('.accordion > h3 > a > i.icon-circle-arrow-down').fadeIn('100');
});
return false;
});
//force all links to open in new tabs
$('#job-container > a').live('click', function() {
window.open($(this).attr('href'));
return false;
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment