Javascript 为什么不是';这不管用吗?jquery

Javascript 为什么不是';这不管用吗?jquery,javascript,jquery,jquery-animate,settimeout,Javascript,Jquery,Jquery Animate,Settimeout,当点击“#drop a”时,它应该在函数之间切换。怎么回事 $(document).ready(function() { $('#drop a').toggle(function() { $('body').animate({'margin-top': '300px'}, 600); setTimeout(function() { $('#drop a').css('background-position', '-40px 0px'

当点击“#drop a”时,它应该在函数之间切换。怎么回事

$(document).ready(function() {
    $('#drop a').toggle(function() {
        $('body').animate({'margin-top': '300px'}, 600);
        setTimeout(function() {
            $('#drop a').css('background-position', '-40px 0px');
        }, 1000);
    }, function() {
        $('body').animate('margin-top': '80px'}, 600);
    });
});

似乎您忘记了起始括号:

// ---------------v
$('body').animate({'margin-top': '80px'}, 600);

这肯定会导致致命错误。

.toggle()
不推荐以这种方式使用。另外,为你的问题选择一个描述性的标题。@ahren那么你有什么建议?