因此,在我当前的项目U中,使用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>
答案 0 :(得分:1)
尝试一下:
.autocomplete-content {
position: absolute;
}