JQuery 选择防止自动垂直滚动
JQuery Chosen prevent automatic vertical scroll
我最近发现了 jQuery Chosen 的一项功能,当您将鼠标悬停在容器底部时,它会自动向下滚动 .chosen-results 容器。
我已经找到了执行此操作的函数 (result_do_highlight):here
这是函数中发生自动滚动的部分:
if high_bottom >= visible_bottom
@search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
else if high_top < visible_top
@search_results.scrollTop high_top
有没有办法防止滚动?
提前致谢
编辑
我分叉了 Chosen-git 并添加了一个解决方法:github.com/puresamari/chosen
使用方法如下:
我这边的变化
我添加了禁用自动滚动到突出显示选项的功能:
像这样使用它:
$('your_select').chosen({
scroll_to_highlighted: false
});
参数“scroll_to_highlighted”是可选的,默认为真
我分叉了 Chosen-git 并添加了一个解决方法:github.com/puresamari/chosen
使用方法如下:
我这边的变化
我添加了禁用自动滚动到突出显示选项的功能:
像这样使用它:
$('your_select').chosen({
scroll_to_highlighted: false
});
参数'scroll_to_highlighted'是可选的,默认为true
我最近发现了 jQuery Chosen 的一项功能,当您将鼠标悬停在容器底部时,它会自动向下滚动 .chosen-results 容器。
我已经找到了执行此操作的函数 (result_do_highlight):here
这是函数中发生自动滚动的部分:
if high_bottom >= visible_bottom
@search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
else if high_top < visible_top
@search_results.scrollTop high_top
有没有办法防止滚动?
提前致谢
编辑
我分叉了 Chosen-git 并添加了一个解决方法:github.com/puresamari/chosen
使用方法如下:
我这边的变化
我添加了禁用自动滚动到突出显示选项的功能: 像这样使用它:
$('your_select').chosen({
scroll_to_highlighted: false
});
参数“scroll_to_highlighted”是可选的,默认为真
我分叉了 Chosen-git 并添加了一个解决方法:github.com/puresamari/chosen
使用方法如下:
我这边的变化
我添加了禁用自动滚动到突出显示选项的功能: 像这样使用它:
$('your_select').chosen({
scroll_to_highlighted: false
});
参数'scroll_to_highlighted'是可选的,默认为true