0

jsFiddle - http://jsfiddle.net/ZEewV/

使用北事件时,动画与对象一起工作。当我添加第二个动画时,两者都不起作用。我似乎无法弄清楚为什么。任何帮助将不胜感激!谢谢!

$("#north").click(function () {
    $(".char").animate({
        top: '-=10px'
    }, 500);
});

$("#south").click(functon() {
    $(".char").animate({
        top: '+=10px'
    }, 500);
});
4

3 回答 3

4

你的第二个函数有错字。它应该function不是“功能”修复它,它会起作用。

于 2013-07-19T01:41:49.343 回答
0

尝试

$("#north").click(function () {
    $(".char").animate({
        top: ($(this).position().top - 10) + "px"
    }, 500);
});

$("#south").click(function() {
    $(".char").animate({
        top: ($(this).position().top + 10) + "px"
    }, 500);
});
于 2013-07-19T01:33:49.927 回答
0

您将“功能”拼错为“功能”。

于 2013-07-19T01:46:45.853 回答