0
在下面的示例代碼中,使用回調函數作爲scrollTop()的參數。jQuery的scrollTop()接受回調函數嗎?
什麼是參數值i和回調訴?
jQuery(document).ready(function() {
var is_dragging = false;
$('ul').disableSelection().sortable({
axis: 'y',
start: function() { is_dragging = true },
stop: function() { is_dragging = false }
}).mousemove(function(e) {
if(is_dragging) {
// **** What are parameters' values i and v of the callback? *****
$('ul').scrollTop(function(i, v) {
var h = $('ul').height();
var y = e.clientY - h/2;
return v + y * 0.1;
});
}
});
});
的示例代碼是從後 Scrolling a sortable/dragable item's parent container when its border is reached
感謝
但功能真的叫,請看到我更新的代碼中,V和I是輸出到控制檯。 http://jsfiddle.net/xjrLN/131/ – thermostat
@thermostat我意識到這太晚了,看到我的編輯。 –