[英]jQuery custom content scroller after ajax call
我在這里發現了很多與此有關的問題,但答案卻很少。 一些答案是advanced:{ updateOnContentResize: true }
,但我嘗試了一下,但是沒有用。 另外,答案之一是在ajax成功時重新初始化.mCustomScroll
函數,但對我來說根本不起作用。 是否有通用的解決方案,或者我應該嘗試其他一些可自定義的滾動庫?
要更新已經具有自定義滾動條的元素上的內容,需要在.mCSB_container元素內(而不是直接添加到您稱為mCustomScrollbar函數的元素內)添加/附加新內容。 例:
//scrollbar initialization
$(".content").mCustomScrollbar();
//at some point later on (within another script, function, ajax call etc.)
$(".content .mCSB_container").append("new content...");
//or targeting a specific .mCSB_container element (usefull with nested scrollbars)
$("#mCSB_1_container").append("new content...");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.