Created
August 25, 2011 08:03
-
-
Save samtardif/1170205 to your computer and use it in GitHub Desktop.
filter for lifestream
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
$("#filter").live("keyup", function (ev) { | |
var $filter = $(this), | |
keyCode = ev.keyCode || ev.which, | |
search; | |
if (keyCode === 27) { //ESC | |
$filter.val(""); | |
} | |
search = $(this).val(); | |
$("#lifestream").find("li").each(function () { | |
var $li = $(this); | |
if (search === "") { | |
$li.show(); | |
} else { | |
if (_.include(service_names, search)) { | |
$li.toggle($li.hasClass("lifestream-" + search)); | |
} else { | |
if ($li.text().search(search) > 0) { | |
$li.show(); | |
} else { | |
$li.hide(); | |
} | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I was trying to implement this filter but seems nothing is happeninng, can you assist on how to use this? I have a dropdown menu to filter my social medias
Thanks!