From e1b82af2c7f780e1381d72aa0aa20d4d5033caf3 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Thu, 17 Dec 2009 20:55:50 +0100 Subject: [PATCH] Re-use the auto suggestion box and make sure it's not overlapped --- data/autosuggestcontrol.css | 1 + data/autosuggestcontrol.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/data/autosuggestcontrol.css b/data/autosuggestcontrol.css index a7ca89d2..db1b1006 100644 --- a/data/autosuggestcontrol.css +++ b/data/autosuggestcontrol.css @@ -5,6 +5,7 @@ div.suggestions { text-align: left; background-color: #ffffff; position: absolute; + z-index: 999; } div.suggestions div { cursor: default; diff --git a/data/autosuggestcontrol.js b/data/autosuggestcontrol.js index 83afeb91..fc82cbf1 100644 --- a/data/autosuggestcontrol.js +++ b/data/autosuggestcontrol.js @@ -53,12 +53,18 @@ AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/) { AutoSuggestControl.prototype.createDropDown = function () { var oThis = this; - //create the layer and assign styles - this.layer = document.createElement("div"); - this.layer.className = "suggestions"; - this.layer.style.visibility = "hidden"; - this.layer.style.width = this.textbox.offsetWidth; + var sDiv = document.getElementById("suggestions_box"); + if (sDiv) + this.layer = sDiv; + else + { + this.layer = document.createElement("div"); + this.layer.className = "suggestions"; + this.layer.id = "suggestions_box"; + this.layer.style.visibility = "hidden"; + this.layer.style.width = this.textbox.offsetWidth; + } this.layer.onmousedown = this.layer.onmouseup = this.layer.onmouseover = function (oEvent) { @@ -275,6 +281,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/ this.layer.style.left = this.getLeft() + "px"; this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px"; this.layer.style.visibility = "visible"; + this.layer.style.position = "absolute"; }; /**