我在后台接口中实现了mCustomScrollbar插件.它工作正常.但在我的一个表单中,我有一个需要自动完成的城市字段.
自动完成也很好.但是当我从自动完成源数据中选择一个项目时,mCustomScrollbar插件会自动将我带到滚动内容的顶部,我必须再次单击以实际选择该项目.
这是我实现滚动条插件的方式:
$('#mainContent').mCustomScrollbar({
set_height: height,
scrollInertia: 500,
scrollEasing: "easeInOutQuad",
mouseWheel: 20,
autoDraggerLength: true,
advanced: {
updateOnBrowserResize: true,
updateOnContentResize: false
}
});
Run Code Online (Sandbox Code Playgroud)
这就是我实现自动完成的方式:
el.autocomplete({
source: function (request, response) {
$.ajax({
url: activityAutocomplete,
dataType: "json",
data: request,
success: function (data) {
if (data.length == 0) {
data.push({
label: "Pas de résultat"
});
}
response(data);
}
});
},
//If overflow edge of window, the autocomplete flips to top of input
position: { collision: "flip" },
autofocus: true,
delay: 150,
minLength: 1,
select: …Run Code Online (Sandbox Code Playgroud)