Last active
August 29, 2015 13:56
-
-
Save renatorib/9267232 to your computer and use it in GitHub Desktop.
jQuery por Data Attributes
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
/* 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