Permalink
Browse files

search as you type animation enhanced

  • Loading branch information...
1 parent d45a976 commit e46d75f9f221bee2e7310be3d858ca247df149a3 @joemsak joemsak committed Jan 7, 2011
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -10,20 +10,23 @@ $(document).ready(function(){
$('#accounts .account').equalHeights();
var
- speed = 500, // animation speed
+ count = 0;
+ speed = 1200, // animation speed
$wall = $('#accounts')
+ options = {
+ columnWidth: 300,
+ // only apply masonry layout to visible elements
+ itemSelector: '.account:not(.kill)',
+ animate: true,
+ animationOptions: {
+ duration: speed,
+ queue: false
+ }
+ }
;
+
- $wall.masonry({
- columnWidth: 300,
- // only apply masonry layout to visible elements
- itemSelector: '.account:not(.invis)',
- animate: true,
- animationOptions: {
- duration: speed,
- queue: false
- }
- });
+ $wall.masonry(options);
//gather the user names of each account in the INDEX list
@@ -34,25 +37,31 @@ $(document).ready(function(){
//bind the filter input on the INDEX list
$('#filter_by_username').keyup(function(){
- var count = 0;
$('.stay_alive').removeClass('stay_alive');
+ count = 0;
+
regexp = new RegExp($(this).val().toLowerCase());
+
for(var i=0; i<usernames.length; i++) {
if(usernames[i].toLowerCase().match(regexp)){
count++;
$('#accounts .account').find('h2:contains('+usernames[i]+')').closest('.account').addClass('stay_alive');
}
}
- $('.stay_alive').removeClass('invis').fadeIn(speed);
- $('.account').not('.stay_alive').addClass('invis').fadeOut(speed);
-
- $wall.masonry();
+ $('.stay_alive').removeClass('kill').fadeIn(speed);
+ $('.account').not('.stay_alive').addClass('kill').fadeOut(speed);
- if ($(this).val() != '') {
+ $wall.masonry(options);
+
+ if ($('#filter_by_username').val() != '') {
$('#filter .results').html(count == 1 ? count+" result" : count+" results");
} else {
$('#filter .results').empty();
+
+ setTimeout(function(){
+ $('.stay_alive').removeClass('stay_alive');
+ }, 700);
}
})
@@ -97,11 +97,17 @@ a.big_link {
color: white;
text-decoration: none;
}
-.account a.big_link:hover {
+.account a.big_link:hover, .account.stay_alive a.big_link {
background-color: #f7f7f7;
-webkit-box-shadow:inset 0 0 5px #888;
-moz-box-shadow:inset 0 0 5px #888;
}
+.account.stay_alive a.big_link{
+ background:rgba(152,251,152,0.3) url(/images/check.png) no-repeat 105% -20px;
+}
+.account.kill a.big_link{
+ background:rgba(250,128,114,0.3) url(/images/reject.png) no-repeat 105% -20px;
+}
.image-wrapper {
max-width: 100px;
float:left;

0 comments on commit e46d75f

Please sign in to comment.