这是当前代码(鼠标向下拖动以增加和减少框架):http: //jsfiddle.net/QHkfJ/
mousedown = false;
frame = 0;
mouse_x_last = 0;
$(document).ready
(
function()
{
$("#load_overlay").mousedown
(
function()
{
mousedown = true;
}
);
$("#load_overlay").mouseup
(
function()
{
mousedown = false;
}
);
$("#load_overlay").mouseleave
(
function()
{
mousedown = false;
}
);
$(window).mousemove
(
function(event)
{
mouse_x = event.pageX;
if(mousedown == true)
{
//if our current mouse position is greater than our last
if(mouse_x > mouse_x_last)
{
//if our frame is within the array
if(frame < 45)
{
//advance frame
frame++
//update debug frame#
$("#frame").html(frame);
}
else
{
//if our frame tries to exceed the array, reset to frame 0
frame = 0;
}
//set our last mouse position
mouse_x_last = mouse_x;
}
//if our current mouse position is lesser than our last
if(mouse_x < mouse_x_last)
{
//if our frame is within the array
if(frame > 0)
{
//decline frame
frame--
//update debug frame#
$("#frame").html(frame);
}
else
{
//if our frame tries to exceed the array, reset to set to 45
frame = 45;
}
//set our last mouse position
mouse_x_last = mouse_x;
}
}
}
);
}
);
我的问题是 ++ & -- 增加“框架”的速度。我想要一种方法来减慢这个速度。
非常感谢。