簡體   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