如何与 Materialize.css 框架自动完成重叠
How to get an Overlap with the Materialize.css Framework Autocompletion
所以在我当前的项目中,你使用了 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;
}
所以在我当前的项目中,你使用了 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;
}