jScrollPane麻烦

我在我的网站上使用过jScrollPane。 我也使用ajax来更新使用jScrollPane的同一div上的数据。 现在,当我将返回的数据附加到div时,滚动条在附加文本上不可见。 这可能是因为当文档加载时调用jQuery函数但是现在有什么想法可以解决这个问题? 我在这里阅读这里的文章http://jscrollpane.kelvinluck.com/auto_reinitialise.html但我无法解决这个问题。 这是代码:

function scrollfunction($value){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ $(ajaxRequest.responseText).appendTo(".div1"); } } ajaxRequest.open("GET", "process.php" , true); ajaxRequest.send(null); } $("document").ready(function() { $(".div1").jScrollPane(); }); 

 $("document").ready(function() { $(".div1").jScrollPane({autoReinitialise: true}); }); 

有没有一个很好的理由不使用jQuery的$ .ajax,因为我相信你在函数中创建的所有处理程序和函数已经内置到$ .ajax中。

 $.ajax({ type: "GET", url: "process.php", dataType: "text", success: function(data){ $(data).appendTo(".jspPane"); } }); 

jspPane通常是由jScrollPane创建的容器,尝试直接附加到该容器。