From 62f14dff648aadc10a25af59ff45c3825c637030 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Wed, 21 Jan 2009 20:10:04 +0000 Subject: The Futon autocomplete dropdown should reposition every time its shown, not only when its first created. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@736399 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/jquery.suggest.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'share') diff --git a/share/www/script/jquery.suggest.js b/share/www/script/jquery.suggest.js index da592317..b414738f 100644 --- a/share/www/script/jquery.suggest.js +++ b/share/www/script/jquery.suggest.js @@ -19,13 +19,8 @@ var cacheKeys = []; var input = $(elem).attr("autocomplete", "off"); - var pos = input.position(); var dropdown = $('') - .addClass(options.dropdownClass).insertAfter(input).css({ - top: (pos.top + input.outerHeight()) + "px", - left: pos.left + "px", - minWidth: input.css("width") - }); + .addClass(options.dropdownClass).insertAfter(input); input .blur(function() { @@ -91,8 +86,12 @@ function show(items, render) { if (!items) return; if (!items.length) { dropdown.hide(); return; } + var pos = input.position(); + dropdown.empty().css({ + top: (pos.top + input.outerHeight()) + "px", left: pos.left + "px", + minWidth: input.css("width") + }); render = render || function(idx, value) { return value; } - dropdown.empty(); for (var i = 0; i < items.length; i++) { var item = $("
  • ").data("value", items[i]); var rendered = render(i, items[i]); -- cgit v1.2.3