延迟Javascript效果500毫秒

时间:2011-06-01 21:40:32

标签: javascript delay easing

我想将slideOutItem延迟500毫秒。无法做到这一点。

if(current === idx) {
    slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true);
    current = -1;
}

2 个答案:

答案 0 :(得分:2)

像这样的东西

if(current === idx) {
    setTimeout(function () { 
        slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true); 
    } , 500);
    current = -1;
}

答案 1 :(得分:0)

function delayed_one  ()
{
   if(current === idx) {
      slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true);
      current = -1;
   }
}

setTimeout ( delayed_one, 500 );