簡體   English   中英

jQuery的動畫隱藏滾動

[英]jquery animate hide the scroll

我有一個小問題,動畫一個overfloweddiv ,動畫期間滾動閃爍。

我做了一個快速的例子:

$(".div-animate").on("click", function(e){
    var toTop = 100,
        toHeight = $(this).outerWidth(true) + toTop;

    $(this).animate({
        top: toTop,
        height: toHeight
    });
});

實例

我怎么能防止這個小小的'滾動眨眼'?

jQuery在使用animate函數時添加了overflow:hidden規則。 您可以執行兩種操作:

1)修改jQuery源代碼行,其中將溢出設置為隱藏(僅當您從網站導入jquery時才能執行此操作)

2)強制你的css中的屬性做這樣的事情

.div-animate {
     overflow: auto !important;
}

那么這也可以這樣做:

$(this).animate({
        top: toTop,
        height: toHeight
    }).css({"overflow":"auto"});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM