Skip to content

Instantly share code, notes, and snippets.

@AllieRays
Created August 4, 2014 01:43
Show Gist options
  • Save AllieRays/4cc8011cbca47877ec3d to your computer and use it in GitHub Desktop.
Save AllieRays/4cc8011cbca47877ec3d to your computer and use it in GitHub Desktop.
fadeIn pdf documents based on select option
//http://documents.cellsearchctc.com/
//language
$('.all, .pt').hide();
$('#selectForm').change(function(event) {
$('.all, .language-list h1').hide();
toggleLanguage(this.value);
});
//country
$('#selectForm2').change(function(event) {
$('.all, .language-list h1').hide();
if ($('.prompt.' + this.value).length > 0) {
$('.prompt.' + this.value).fadeIn('slow');
$('#selectForm').attr('disabled', 'disabled');
}
else {
$('.language-list h1').show();
$('.pt').hide();
$('#selectForm').removeAttr('disabled');
toggleLanguage($('#selectForm').val());
}
});
$('.it').change(function(event) {
$('.all, .language-list h1').hide();
$('.prompt').fadeIn('slow');
});
$('.prompt .accept').click(function() {
toggleLanguage($('#selectForm').val());
$('#selectForm').removeAttr('disabled');
});
$('.prompt .reject').click(function() {
$('.prompt-one').hide();
$('.reject-message', $(this).parents('.prompt')).fadeIn('slow');
});
});
function toggleLanguage(language) {
if(language == 'all') return;
$('.' + language).fadeIn('slow');
$('.prompt').hide();
$('.prompt-one').show();
$('.reject-message').hide();
$('.language-list h1').each(function() {
if ($(this).next('ul').find('li:visible').length === 0) {
$(this).hide();
} else {
$(this).show();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment