2012-08-23 172 views
0

我已经完成滚动条与jQuery custom content scroller就好,但有一些问题。确切地说,我已经完成了这个带有d​​iv标签的滚动条,其中我从mysql(某些帖子)中检索数据,所以我的问题是我使用ajax将数据发送到数据库并且它也可以工作,但是当数据被追加在div标签上,scroller具有固定的大小,它不是续订(只有刷新页面时才更新)。用Ajax添加数据时如何更新滚动条大小?而且我也无法理解最后如何修复滚动条?请帮助我很困惑这个问题,谢谢:)jQuery自定义内容滚动滚动

PS。这里插件主页太http://manos.malihu.gr/jquery-custom-content-scroller

UPDATE

$.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); 
         } 
        }); 
       } 
      }); 

在这个代码仅值得注意的是如何将数据发送到数据库后更新mCustomScrollbar()回调中的功能,

回答

1

看看在Fluid scrollbar demo

编辑

如果不尝试的作品在Ajax请求后重新初始化.mCustomScrollbar() -functon。

EDIT 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 
        } 
       }); 
      } 
     }); 
    } 
});​ 
+0

我已为自己这个页面,刚刚发布的问题,因为不明白该怎么做 – tnanoba

+0

它必须是书面withing阿贾克斯成功脚本是? – tnanoba

+0

而且我已经阅读过文档,但我猜不知道如何在默认情况下最终修复它,这有可能吗? – tnanoba