Created
September 16, 2013 14:39
-
-
Save jserrao/6581568 to your computer and use it in GitHub Desktop.
Doing an accordion with font icons that fade in/out
This file contains 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
<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