Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery UI可拖动滚动速度的单位是什么?_Javascript_Jquery_Css_Jquery Ui_Jquery Ui Draggable - Fatal编程技术网

Javascript jQuery UI可拖动滚动速度的单位是什么?

Javascript jQuery UI可拖动滚动速度的单位是什么?,javascript,jquery,css,jquery-ui,jquery-ui-draggable,Javascript,Jquery,Css,Jquery Ui,Jquery Ui Draggable,我不明白“100”是什么意思。是每秒100像素吗,毫秒? 此代码取自: #可拖动,#可拖动2,#可拖动3{宽度:100px;高度:100px;填充:0.5em;浮动:左侧;边距:0 10px 10px 0;} $(函数(){ $(“#draggable3”).draggable({scroll:true,scrollSpeed:100}); } ); 滚动速度设置为100 Jquery滚动速度始终是以步为单位确定的。这意味着在相关滚动速度下的每个滚动将是用户向上或向下移动的像素数。一个滚动=一

我不明白“100”是什么意思。是每秒100像素吗,毫秒? 此代码取自:


#可拖动,#可拖动2,#可拖动3{宽度:100px;高度:100px;填充:0.5em;浮动:左侧;边距:0 10px 10px 0;}
$(函数(){
$(“#draggable3”).draggable({scroll:true,scrollSpeed:100});
} );
滚动速度设置为100


Jquery滚动速度始终是以步为单位确定的。这意味着在相关滚动速度下的每个滚动将是用户向上或向下移动的像素数。一个滚动=一个步骤

例如:100 scrollSpeed意味着每600-800毫秒的每一步都是100像素。尽管这一衡量标准存在很大差异

滚动速度的测量值是一个刻度为1000(最大值)的数字

请记住,scrollSpeed主要由最终用户所在的浏览器控制。因此,获取像素/秒是一个艰难的测量,尤其是当用户输入每滚动一次时

例如,Chrome可能与Safari不同

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


它可能只是某个任意最大值的一部分,与特定的单位无关。你需要单位有什么原因吗?
<!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>
scrollSpeed 
Type: Number
Default: 20
The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance. Ignored if the scroll option is false.
Code examples:
Initialize the draggable with the scrollSpeed option specified: