Ticket #3576 (closed enhancement: invalid)
[autocomplete] Showing results at page bottom, and not at the input field
| Reported by: | Tomasso | Owned by: | joern |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | plugin | Version: | 1.2.6 |
| Keywords: | autocomplete, scroll | Cc: | Pablote.20@… |
| Blocking: | Blocked by: |
Description
When the autocomplete input field is inside a div which has a scrollbar, the results will not be shown at the input field position as expected, but probably at the bottom of the page. To fix that issue I modified the showResults function as follows:
function showResults() {
get the position of the input field right now (in case the DOM is shifted) var pos = findPos(input); either use the specified width, or autocalculate based on form element var iWidth = (options.width > 0) ? options.width : $input.width();
var firstParentDIV; var currentNode = input; while (currentNode.tagName.toLowerCase() != "div"){
currentNode = currentNode.parentNode;
}
reposition $results.css({
width: parseInt(iWidth) + "px", top: ((pos.y + input.offsetHeight) - currentNode.scrollTop) + "px", left: pos.x + "px"
}).show();
};
Thank You:
Pablo Tomas Borda Di Berardino
Change History
comment:2 Changed 4 years ago by dmethvin
This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
