gpt4 book ai didi

javascript - 如何使用 Materialize.css 框架自动完成获得重叠

转载 作者:太空宇宙 更新时间:2023-11-04 07:08:02 25 4
gpt4 key购买 nike

所以在我当前的元素中,你使用了 Materialize.css 中的自动完成功能,我还在下面做了一个简单的例子,这样你就可以看到我的问题。

每当显示自动完成的结果时,下面的内容就会被下推,我想阻止这种情况,因为它看起来很丑,而且我页面上的输入正好在其他内容之上,我不想那样移动。

如果能帮助我实现该目标,我将不胜感激。

The Materialize.css Autocomplete Docs

$(document).ready(function() {
$('input.autocomplete').autocomplete({
data: {
"Apple": null,
"Microsoft": null,
"Google": 'https://placehold.it/250x250'
},
limit: 20, // The max amount of results that can be shown at once. Default: Infinity.
onAutocomplete: function(val) {
// Callback function when value is autcompleted.
},
minLength: 1, // The minimum length of the input for the autocomplete to start. Default: 1.
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" rel="stylesheet" />
<div class="row">
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="text" id="autocomplete-input" class="autocomplete">
<label for="autocomplete-input">Autocomplete</label>
</div>
</div>
</div>
<div class="col s12">
This is my Example Div
<br> lALLALALALAALA <br> lALLALALA
</div>
</div>

最佳答案

试试这个:

.autocomplete-content {
position: absolute;
}

关于javascript - 如何使用 Materialize.css 框架自动完成获得重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51412120/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com