Reputation: 4168
I have a small problem. I have a js ajax call to php.
PHP:
echo '<div class="center-right-inside"></div>';
Before ajax I create divs
$('.main').fadeIn('slow').html('<div class="right-left"><div class="left-c"></div><div class="center-c"></div><div class="right-c"></div></div>');
In my JS I use plugin http://manos.malihu.gr/jquery-custom-content-scroller/ And after in created div I load another div on witch I want to use plugin... But no luck
complete :function(){
$('.center-c').fadeIn();
$('.center-right-inside').mCustomScrollbar("update");
}
I tried:
$(".center-right-inside").mCustomScrollbar();
this on DOM ready and it is working fine but when ajax is complete no...
Before posting this question I read Docs of the plugin and search at google and SO but couldnt find any similar if any suggestion thanks in advance.
Upvotes: 0
Views: 2676
Reputation: 287
You can try this and i hope this can help you.
$(document).ajaxComplete(function(){
$(".center-right-inside").mCustomScrollbar();
});
Because you want create CustomScrollbar after ajaxcomplete so you need usage ajaxComplete
Sorry my english not good :(
Upvotes: 0
Reputation: 11
After having a data from ajax, if you will change the HTML attribute of the , you must change the particular area only.
> $("#content_1 .mCSB_container").html(data); //load new content inside
> .mCSB_container
> $("#content_1").mCustomScrollbar("update"); //update scrollbar according to newly loaded content
Upvotes: 1
Reputation: 4168
$(".center-right-inside").mCustomScrollbar({
advanced:{
updateOnContentResize: true
}
});
This should help!
Upvotes: 0
Reputation: 40
A very common mistake is that the user forgot to include the Jquery libary in their file, did you forgot ? - That might be the issue.
Else Try:
$(".center-right-inside").load(function(){
$(".center-right-inside").mCustomScrollbar("update");
});
Upvotes: 0