Thanks so much for hacking. I used this myself, but modified it, so it is only called when Ajax.Autocompleter is used, doing the following.
function positionAuto(element, entry) { setTimeout( function() { Element.clonePosition('choices_div', 'text_element', { 'setWidth': false, 'setHeight': false, 'offsetTop': $('text_element').offsetHeight } ); }, 300); return entry; } new Ajax.Autocompleter('text_element', 'choices_div', [url to web service], { paramName: 'fulltext', minChars: 2, callback: positionAuto,
Since the callback is called immediately before the actual request, the positioning of the DIV at this moment makes the most sense. And make sure that even if the window is resized or scrolled, the DIV is positioned correctly. What is crazy is that in order to make it work sequentially, I had to wrap it in "setTimeout ()". Not experimented with different sync settings so much, but if there is a lower timeout threshold that works, I would like to know.
Tested on IE 8 and 7 and works very well. And works with other real browsers. Hope this saves some headaches from coders when dealing with this.
Jakegould
source share