jQuery UI draggable scrollSpeed的单位是什么?

我不明白“ 100”的含义。每秒100像素吗? 该代码摘自:https://jqueryui.com/draggable/#scroll

<!doctype html>
<html lang="en">
<head>

  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
   #draggable,#draggable2,#draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left;        margin: 0 10px 10px 0; }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#draggable3" ).draggable({ scroll: true,scrollSpeed: 100 });
  } );
  </script>
</head>
<body>

<div id="draggable3" class="ui-widget-content">
 <p>scrollSpeed set to 100</p>
</div>

<div style="height: 5000px; width: 1px;"></div>


</body>
</html>
kingjohy 回答:jQuery UI draggable scrollSpeed的单位是什么?

jQuery scrollSpeed始终是逐步确定的。这意味着以相关的scrollSpeed进行的每个滚动将是用户向上或向下移动多少像素。一卷=一步。

例如:100 scrollSpeed表示每一步为每600-800ms 100px。尽管此方法存在很多差异

scrollSpeed的度量是一个数字,最大为1000(最大)

请记住,scrollSpeed也主要由最终用户所使用的浏览器控制。因此,获得像素/秒是一个艰难的衡量标准,尤其是当用户输入每次滚动变化时。

例如Chrome可能与Safari不同

在下面的文章中,他们提到了如何调节像素/秒滚动速度:

Slowing the speed of a Jquery Scroll

,
Architecture:        x86_64
CPU op-mode(s):      32-bit,64-bit
Byte Order:          Little Endian
CPU(s):              256
On-line CPU(s) list: 0-255
Thread(s) per core:  2
Core(s) per socket:  64
Socket(s):           2
NUMA node(s):        2
Vendor ID:           AuthenticAMD
CPU family:          23
Model:               49
Model name:          AMD EPYC 7742 64-Core Processor
Stepping:            0
CPU MHz:             1499.900
CPU max MHz:         2250.0000
CPU min MHz:         1500.0000
BogoMIPS:            4499.95
Virtualization:      AMD-V
L1d cache:           32K
L1i cache:           32K
L2 cache:            512K
L3 cache:            16384K
NUMA node0 CPU(s):   0-63,128-191
NUMA node1 CPU(s):   64-127,192-255
本文链接:https://www.f2er.com/3122223.html

大家都在问