LEATH
2021-12-23 19:04:38
我不明白“100”是什么意思。是每秒 100 像素嗎?此代碼取自:https : //jqueryui.com/draggable/#scroll<!doctype html><html><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>
2 回答

慕哥6287543
TA貢獻1831條經驗 獲得超10個贊
Jquery scrollSpeed 總是分步確定的。這意味著以相關的 scrollSpeed 每次滾動將是用戶向上或向下移動的像素數。一卷=一步。
例如:100 scrollSpeed 表示每一步是 100px 每 600-800ms。雖然這個衡量標準存在很大差異
scrollSpeed 的度量是一個數字,范圍為 1000(最大)
請記住,scrollSpeed 也主要由最終用戶所在的瀏覽器控制。所以獲得像素/秒是一個艱難的衡量標準,尤其是當用戶輸入隨滾動而變化時。
前任。Chrome 可能與 Safari 不同

繁花如伊
TA貢獻2012條經驗 獲得超12個贊
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:
添加回答
舉報
0/150
提交
取消