【问题标题】:Hover out jQuery elastic slide-back not working悬停在 jQuery 弹性后退不工作
【发布时间】:2012-04-23 20:20:24
【问题描述】:

我在让返回动画在悬停状态下播放时遇到了一点问题。

$("#porttab").hover(function(){
    $(this).stop().animate({"top" : "40px"}, {
        duration: 'slow',
        easing: 'easeOutElastic'
    }, function(){
        $(this).stop().animate({"top": "-40px"}, {
            duration: 'slow',
            easing: 'easeOutElastic'
        });
    });
});

我不知道我在这里做错了什么,但我有点 jquery 菜鸟所以请温柔。

而且我正在使用缓动插件,如果这有影响的话。

【问题讨论】:

    标签: jquery animation hover jquery-easing


    【解决方案1】:

    我认为你错过了关闭悬停的第一个参数..见下文

    $("#porttab").hover(function() {
        $(this).stop().animate({
            "top": "40px"
        }, {
            duration: 'slow',
            easing: 'easeOutElastic'
        });
    }, function() {
        $(this).stop().animate({
            "top": "-40px"
        }, {
            duration: 'slow',
            easing: 'easeOutElastic'
        });
    });
    

    【讨论】:

    • 你是救生员,伙计!这让我发疯了。
    • 正确还款救生是点击他的答案旁边的复选标记。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多