Created
October 26, 2011 23:48
-
-
Save whyisjake/1318362 to your computer and use it in GitHub Desktop.
Looking for an easy way to load a php array into some jQuery... Any ideas on how to simplify this?
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> | |
<?php $arr = array(185,4,171); ?> | |
$(document).ready(function(){ | |
/* Put your jQuery here */ | |
$('.post-4').hide(); | |
$('.post-171').hide(); | |
$('.click185').addClass('active'); | |
$('.click185').click(function() { | |
$('.post-4,.post-171').hide(); | |
$('.post-185').show(); | |
$('.click185').addClass('active'); | |
$('.click171, .click4').removeClass('active'); | |
}); | |
$('.click4').click(function() { | |
$('.post-185,.post-171').hide(); | |
$('.post-4').show(); | |
$('.click4').addClass('active'); | |
$('.click171, .click185').removeClass('active'); | |
}); | |
$('.click171').click(function() { | |
$('.post-171').show(); | |
$('.post-4,.post-185').hide(); | |
$('.click171').addClass('active'); | |
$('.click4, .click185').removeClass('active'); | |
}); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ty, this is awesome. Thanks again.