jQuery自定义内容滚动条滚动
我已经用jQuery自定义内容滚动条滚动,jquery,jquery-plugins,Jquery,Jquery Plugins,我已经用jQuery自定义内容滚动器完成了滚动条,但有一些问题。确切地说,我已经用div标记完成了这个滚动条,我在其中从mysql(一些帖子)检索数据,所以我的问题是,我使用ajax将数据发送到数据库,它也可以工作,但当数据附加到div标记上时,滚动条具有固定的大小,它不会更新(仅在页面刷新时更新)。如何在使用ajax添加数据时更新滚动条大小?而且我也不明白怎么可能在最后修复滚动条?请帮忙我对这个问题很困惑,谢谢:) 这里是插件主页太 更新 $.ajax({ ur
jQuery自定义内容滚动器完成了滚动条,但有一些问题。确切地说,我已经用div标记完成了这个滚动条,我在其中从mysql(一些帖子)检索数据,所以我的问题是,我使用ajax将数据发送到数据库,它也可以工作,但当数据附加到div标记上时,滚动条具有固定的大小,它不会更新(仅在页面刷新时更新)。如何在使用ajax添加数据时更新滚动条大小?而且我也不明白怎么可能在最后修复滚动条?请帮忙我对这个问题很困惑,谢谢:)
这里是插件主页太
更新
$.ajax({
url: "ajax/posting.php",
type: "POST",
data: {send_post: "Send", user_id: "<?php echo $userArr[0]; ?>", user_name: "<?php echo $userArr[2] . " " . $userArr[3]; ?>", msg: $("#post").val()},
complete: function(){
$("#post").val("");
},
success: function(result){
$.ajax({
url: "ajax/posting.php",
type: "POST",
data: {renew_posts: "Yes",admin: "<?php echo $userArr[1]; ?>",owner: "<?php echo $userArr[0]; ?>"},
success: function(renewed_data){
$("#chat_tb").html(renewed_data);
(function($){$(window).load(function(){$(".post_container").mCustomScrollbar({
scrollButtons:{enable:true,scrollSpeed: 40}
});});})(jQuery);
}
});
}
});
$.ajax({
url:“ajax/posting.php”,
类型:“POST”,
数据:{send#u post:“send”,用户id:,用户名:,消息:$(“#post”).val(),
完成:函数(){
$(“#post”).val(“”);
},
成功:功能(结果){
$.ajax({
url:“ajax/posting.php”,
类型:“POST”,
数据:{更新帖子:“是”,管理员:,所有者:},
成功:功能(更新的数据){
$(“#chat_tb”).html(更新的#u数据);
(函数($){$(窗口).load(函数(){$(“.post_容器”).mCustomScrollbar({
scrollButtons:{enable:true,scrollSpeed:40}
});});})(jQuery);
}
});
}
});
在这段代码中,在将数据发送到数据库之后,如何在回调中更新mCustomScrollbar()函数是值得注意的
编辑
如果不起作用,请尝试在ajax请求后重新初始化.mCustomScrollbar()
-functon
编辑2
试一试:
$.ajax({
url: "ajax/posting.php",
type: "POST",
data: {
send_post: "Send",
user_id: "<?php echo $userArr[0]; ?>",
user_name: "<?php echo $userArr[2] . "" . $userArr[3]; ?>",
msg: $("#post").val()
},
complete: function() {
$("#post").val("");
},
success: function(result) {
$.ajax({
url: "ajax/posting.php",
type: "POST",
data: {
renew_posts: "Yes",
admin: "<?php echo $userArr[1]; ?>",
owner: "<?php echo $userArr[0]; ?>"
},
success: function(renewed_data) {
$("#chat_tb").html(renewed_data);
$(".post_container").mCustomScrollbar({
scrollButtons: {
enable: true,
scrollSpeed: 40
}
});
}
});
}
});
$.ajax({
url:“ajax/posting.php”,
类型:“POST”,
数据:{
发送帖子:“发送”,
用户id:“”,
用户名:“”,
msg:$(“#post”).val()
},
完成:函数(){
$(“#post”).val(“”);
},
成功:功能(结果){
$.ajax({
url:“ajax/posting.php”,
类型:“POST”,
数据:{
更新帖子:“是”,
管理员:“,
业主:“
},
成功:功能(更新的数据){
$(“#chat_tb”).html(更新的#u数据);
$(“.post_container”).mCustomScrollbar({
滚动按钮:{
启用:对,
滚动速度:40
}
});
}
});
}
});
我已经发布了我自己的这一页,只是发布了一个问题,因为我不明白如何做到这一点。它必须使用ajax成功脚本编写。是吗?我也阅读了文档,但我猜我不明白如何在默认情况下在最后修复它,是否可能?是和否,您需要将其作为回调函数来执行。看看上下文:如果您给我们一个小的代码片段,我们可以更容易地帮助您;-)