jQuery的自动完成插件1.2.3响应宽度下拉 [英] jQuery Autocomplete Plugin 1.2.3 responsive width dropdown

查看:162
本文介绍了jQuery的自动完成插件1.2.3响应宽度下拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人目前使用的这种自动完成插件在github上?当你调用自动完成功能,你可以通过宽度变量在下拉框中的像素,即宽:200。

Has anyone used this autocomplete plugin currently in github? when you call the autocomplete function you can pass the width variable in pixels of the dropdown box, i.e. "width:200,".

我想下拉成为大小输入字段相同。当你知道输入字段的宽度,但该工作正常使用的宽度取决于您使用的设备,你会如何去了解它设置为当前输入字段的宽度呢?而改变的响应输入字段时

I want the dropdown to be the same size as the input field. This works fine when you know the width of the input field, but when using a responsive input field which changes width depending on the device your using, how would you go about setting this to the width of the current input field?

推荐答案

如果你在谈论这个插件:的 https://github.com/devbridge/jQuery-Autocomplete

If you're talking about this plugin: https://github.com/devbridge/jQuery-Autocomplete.

我遇到了同样的问题,并提出了解决方法。我设置宽度为这样的固定值:

I ran into the same problem and made a workaround. I set the width as a fixed value like this:

$('#input').autocomplete({
    width: 780
});

那么,对于页面调整大小我运行这个功能:

Then whenever the page resizes I run this function:

function page_resize(){
    $('.autocomplete-suggestions').css('width', $('#input').width());
}

这篇关于jQuery的自动完成插件1.2.3响应宽度下拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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