AkilaH AkilaH - 4 months ago 178
jQuery Question

jQuery mCustomScrollbar not working on ajax content

$(window).load(function(){
$("#content_1").mCustomScrollbar({
scrollButtons:{
enable:true
}
});

// ajax code
function beauty_of_ceylon() {
$('.content-text').html('<p style="position:absolute;"><img src="images/ajax-loader.gif" /></p>');
$('.content-text').load("packages/beauty-of-ceylon.php");
}

Answer
$('.content-text').load("packages/beauty-of-ceylon.php", function () {
    $("#content_1").mCustomScrollbar({
        scrollButtons:{
            enable:true
        }
    });
    $content = '<button id="update" onclick="$('#content_1').mCustomScrollbar('update');" style="display:none"></button>';
    $('.content-text').append($content);
    setTimeout("$('#update').click();",10);
});

It work for me :D