Skip to content

Instantly share code, notes, and snippets.

@nelsson
Created December 27, 2019 18:37
Show Gist options
  • Select an option

  • Save nelsson/6feb5bacee7cecd97a8f9d4f2ebd0b52 to your computer and use it in GitHub Desktop.

Select an option

Save nelsson/6feb5bacee7cecd97a8f9d4f2ebd0b52 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
$(function(){
function select(item, title, contenido){
$(item).eq(0).find(title).addClass('active');
$(item).eq(0).find(contenido).show();
$(title).click(function () {
if ($(this).hasClass('active')){
$(this).next(contenido).slideUp().css('height', 'auto');
$(this).removeClass('active');
}
else {
$(title).not(this).next(contenido).slideUp();
$(title).not(this).removeClass('active');
$(this).next(contenido).slideDown();
$(this).addClass('active');
}
});
}
select('.n-itemacordeon','.n-title-acordeon', '.n-contenido-acordeon');
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment