jQuery如何正确设置间隔?

时间:2013-04-16 17:00:53

标签: jquery slider setinterval intervals

目前我有这个,但它一直返回“swapBKgnd没有定义”:

    var interval = self.setInterval("swapBKgnd()", 9000);

function swapBKgnd() {

    (direction === 'next') ? ++current : --current;

    if (current === 0) {
        current = imgsLenth;
        direction = 'next';
    } else if (current - 1 === imgsLenth) {
        current = 1;
        loc = 0;
    }


    transition(sliderUL, loc, direction);
};

感谢。

1 个答案:

答案 0 :(得分:0)

swapBKgnd()删除引号。

使用可以做:

var interval = self.setInterval(swapBKgnd, 9000);

您尚未声明directioncurrentloc - 这些会导致错误