Created
March 22, 2013 06:06
-
-
Save dburles/5219315 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<style type="text/css"> | |
#ffs { | |
top: 0; | |
left: 0; | |
position: fixed; | |
padding: 5px; | |
background: #DDD; | |
} | |
#ffs input { | |
font: 13px arial; | |
color: black; | |
} | |
</style> | |
<script type="text/javascript"> | |
$(function() { | |
/* floating filter search */ | |
// set these | |
var container = '#poks li'; | |
var target = 'span'; | |
$('#ffs input').keyup(function(e) { | |
if (e.keyCode == 27) { | |
$(this).val(""); | |
} | |
var search = $(this).val().toLowerCase(); | |
$(container).each(function() { | |
var element = $(this).closest($(container)); | |
$(this).find(target).text().toLowerCase().indexOf(search) == -1 ? element.hide() : element.show(); | |
}); | |
}); | |
}); | |
</script> | |
<div id="ffs"> | |
<input type="text" name="search" placeholder="find"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment