function roll(x) {
            //执行前禁用点击事件?
            var divHeight = $("#rollNews").height();
            var top = parseInt($("#rollNews").css("top").replace("px", ""));
            top += x;
            if (divHeight == -top) {
                top = 0;
            }
            $("#rollNews").stop(true).animate({ top: top + "px" }, 1000, null, function () {
                //动画执行完了启用点击事件?
            });
        }
stop(true)

解决方案 »

  1.   

    按照你思路的求解var roll = ( 
    function(){
    var isrun  = false;
    return function roll(x) {
                //执行前禁用点击事件?
                if(isrun){return;}
                isrun = true;            var divHeight = $("#rollNews").height();
                var top = parseInt($("#rollNews").css("top").replace("px", ""));
                top += x;
                if (divHeight == -top) {
                    top = 0;
                }
                $("#rollNews").stop(true).animate({ top: top + "px" }, 1000, null, function () {
                    //动画执行完了启用点击事件?
                    isrun = false;
                });
            }
    })();