【发布时间】:2011-06-23 04:19:51
【问题描述】:
使用 jQuery UI 创建一个替代的可选对象,显示为具有超过三千个元素的层次结构。
基本上,使用 jQuery 1.6.1,除了来自 jQuery UI 的 CSS
<style type="text/css">
.selectable,
.selectable li
{
moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
</style>
<script type="text/javascript">
$(function () {
$('.seletable li').click(function () { alert('hullo') });
});
</script>
在体内
<ol class="seletable">
<li style="margin-left: {calculated according to the current level in hierarchy}">...</li>
...
</ol>
有序列表当然会有 3k + 列表元素。
在加载页面并单击和元素时,警告框在 Google Chrome 和其他 WebKit 浏览器(如 Safari)中似乎显着延迟一到两秒,但在其他浏览器(如 IE、Firefox 和 Opera)中正常运行。
【问题讨论】:
-
没关系,与-webkit-user-select有关:无;使用 用于 WebKit 浏览器。谢谢。
标签: javascript jquery google-chrome webkit click