Skip to content

Instantly share code, notes, and snippets.

@renatorib
Last active August 29, 2015 13:56
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 renatorib/9267232 to your computer and use it in GitHub Desktop.
Save renatorib/9267232 to your computer and use it in GitHub Desktop.
jQuery por Data Attributes
/* Filtro de Conteudo por Atributos Data */
$('[data-slct]').click(function(e){
$('[data-slct]').removeClass('active');
$(this).addClass('active');
var scope = $(this).data('slct-name');
var selected = $(this).data('slct');
$("[data-"+ scope +"]").not("[data-"+ scope +"*='"+ selected +"']").fadeOut('fast');
$("[data-"+ scope +"*='"+ selected +"']:hidden").fadeIn('fast');
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment