我的应用程序是 aps.net MVC,我是否使用 ajax 加载多个图像,通过获取鼠标 Y 位置,它可以工作,但是如果我将鼠标移动超过一个像素,例如 100,它会一次加载所有图像!为了测试脚本,我添加了警报,当用户单击确定时,图像按预期前进。我尝试了 setInterval 和 Timeout,都没有奏效。这是我的代码:
$("#container2").bind('mousemove', function (e) {
lastX = e.pageX - position.x;
lastY = e.pageY - position.y;
coordinate = "x=" + lastX + ", y=" + lastY;
$('#pValue').val(coordinate);
$('#lastX').val(lastX);
$('#lastY').val(lastY);
waitStep = lastY >= 0 ? 1 : -1;
waitInc = waitStep;
waitCounter = lastY;
for (var n = 0; n < Math.abs(lastY); n += 1) {
// imageSequence[n] = new Image();
dicom1.src = '/Home/GenerateImage?' + $.param({
pX: pointXF,
pY: pointYF,
pZ: waitInc * sThickness
});
waitInc = waitInc + waitStep;
alert(waitInc);
}
非常感谢您的建议,在此先感谢。