简体   繁体   English

jQuery滑块切换动画不起作用

[英]jquery slider toggle animation not working

im trying to get my slider to work. 我试图让我的滑块工作。 I know how I could make one, but i am trying to use toggle() .. it has proven to be quite difficult, does anyone know anything i dont? 我知道我该怎么做,但是我正在尝试使用toggle() ..事实证明这很困难,有人知道我什么都不知道吗?

http://jsfiddle.net/kr2wE/ 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);
});

The correct version of this form is this 此表格的正确版本是这样

Note: This function was deprecated in jQuery 1.8 and removed in 1.9 https://api.jquery.com/toggle-event/ . 注意:此功能在jQuery 1.8中已弃用,在1.9 https://api.jquery.com/toggle-event/中已删除。 So I would strongly advise you not to use it. 因此,我强烈建议您不要使用它。

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

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