diff options
author | Christopher Lenz <cmlenz@apache.org> | 2009-01-21 20:10:04 +0000 |
---|---|---|
committer | Christopher Lenz <cmlenz@apache.org> | 2009-01-21 20:10:04 +0000 |
commit | 62f14dff648aadc10a25af59ff45c3825c637030 (patch) | |
tree | 205b1b988dace2fa1fb5cd489c724795d4a47f89 /share/www/script/jquery.suggest.js | |
parent | 03d03bdaf3d86de48444ca768a024362fa63ca24 (diff) |
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
Diffstat (limited to 'share/www/script/jquery.suggest.js')
-rw-r--r-- | share/www/script/jquery.suggest.js | 13 |
1 files changed, 6 insertions, 7 deletions
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 = $('<ul style="display: none; position: absolute; z-index: 10000"></ul>') - .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 = $("<li></li>").data("value", items[i]); var rendered = render(i, items[i]); |