I am using AJAX to bring more data to my div
and mcustomscrollbar
to scroll. What I want is as soon as the data is loaded for my div
to focus on the very element of the loaded data. For example, if the loaded data starts from 6 to 10 so div
should show the data from 6.
My code reads like this
function generatemCustomeScrollbar(elementID)
{
$(elementID).mCustomScrollbar({
scrollButtons: {
enable: false
},
theme:"rounded",
scrollEasing: "easeOut",
moveDragger: true,
mouseWheel: {scrollAmount: 200},
keyboard: {enable: 1},
keyboard: {scrollAmount: 200},
keyboard: {scrollType: "stepless"},
contentTouchScroll: 200,
scrollbarPosition: "outside",
alwaysTriggerOffsets: true,
advanced: {
updateOnBrowserResize: true,
updateOnContentResize: true
}
});
}
I have initialize the scrollbar on document.ready...
generatemCustomeScrollbar(".myDiv");
and my ajax look like this... it's example
$.ajax({
type:'POST',
url:base_url+'ajax_more_near_poi',
dataType:'json',
data:data_send,
success: function(data){
if(data.error_msg){
$(".myParentDiv").html(data.error_msg);
}else{
console.log("success");
$(".myDiv").append(data.html_detail);
}
overloading = false;
},
error: function(){
console.log("error");
overloading=false;
}
});