'); } resultsList.fadeIn(200); } $('.search-results').css( { 'width': input.innerWidth() + 2 }); }); } }); //setTimeout(function(){ )}, 5); }); // Clicking outside makes the results disappear. $('body').bind('click', function(){ $('.search-results').hide(); }); $(window).resize(function(){ var input = $('form[action="/search"]').find('input[name="q"]'); if(input.length == 0) return false; var offSet = input.position().top + input.innerHeight() + 1; $('.search-results').css( { 'position': 'absolute', 'left': '0px', 'top': offSet, 'width': input.innerWidth() + 2 } ); }) });