Fel*_*zzo 2 javascript jquery timer settimeout jquery-animate
我遇到了setTimeout()的问题.我希望,在mouseout状态下,子菜单会在一段时间(500毫秒)后向上滑动.但是setTimeout()不起作用.
喜欢这个链接:http://jsfiddle.net/felipepalazzo/Xyhvn/2/
代码:
(function($){
    $.fn.showMenu = function(options){
        var settings = $.extend({
            height  : '40px',
            speed   : '500',
            heightx : '20px'              
        }, options || {});
        return this.each(function(){
           var elem = $(this);
           var menu_timer;
            elem.hover(function(){
                $(this).stop().animate({'height' : settings.height}, settings.speed);
                    }, function(){
                      //setTimeout(function(){  
                      $(this).stop().animate({'height' : settings.heightx}, settings.speed);
                            //},500);
                    }); 
        });      
    };
})(jQuery);
这超出了范围.
var that = this;
setTimeout(function(){
    $(that).stop().animate({'height' : settings.heightx}, settings.speed);
},500);