繁体   English   中英

jQuery滑块切换动画不起作用

[英]jquery slider toggle animation not working

我试图让我的滑块工作。 我知道我该怎么做,但是我正在尝试使用toggle() ..事实证明这很困难,有人知道我什么都不知道吗?

http://jsfiddle.net/kr2wE/

$("#slider").on("click", function () {
    $("#slider").toggle(function () {
        $(this).animate({
            "height":"100px"
        }, 1000);
    }, function () {
        $(this).animate({
            "height":"0"
        }, 1000);
    });
});
$("#slider").toggle(function () {
    $(this).animate({
        "height":"100px"
    }, 1000);
}, function () {
    $(this).animate({
        "height":"20px"
    }, 1000);
});

此表格的正确版本是这样

注意:此功能在jQuery 1.8中已弃用,在1.9 https://api.jquery.com/toggle-event/中已删除。 因此,我强烈建议您不要使用它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM