更改 jQuery UI 自动完成位置 - 弹出而不是向下 [英] Change jQuery UI Autocomplete Position - Pop up, instead of down

查看:27
本文介绍了更改 jQuery UI 自动完成位置 - 弹出而不是向下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面底部放置了一个自动完成框,我希望结果弹出文本框上方,而不是下方.我怎样才能做到这一点?

I am placing an autocomplete box at the bottom of my page and I would like the results to pop up OVER the text box, instead of below. How can I do this?

推荐答案

似乎我已经能够回答我自己的问题了.如果有人得到它,我愿意接受更好的解决方案.我将此添加到自动完成启动中.. 本质上它会将打开的框重新定位到新的偏移量.

Seems as if I've been able to answer my own question already. I'm open to a better solution if someones got it. I added this to the autocomplete start up.. essentially it repositions the box on open to a new offset.

open: function(event, ui) {
    var autocomplete = $(".ui-autocomplete");
    var oldTop = autocomplete.offset().top;
    var newTop = oldTop - autocomplete.height() - $("#quick_add").height() - 10;

    autocomplete.css("top", newTop);
}

这篇关于更改 jQuery UI 自动完成位置 - 弹出而不是向下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆