我在我的网站上使用过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();
});发布于 2011-10-01 23:24:10
$("document").ready(function() {
$(".div1").jScrollPane({autoReinitialise: true});
});因为我相信你在函数中创建的所有处理程序和函数都已经内置于$.ajax中,所以不使用jQuery的$.ajax有什么很好的理由吗?
$.ajax({
type: "GET",
url: "process.php",
dataType: "text",
success: function(data){
$(data).appendTo(".jspPane");
}
});jspPane通常是由jScrollPane创建的容器,尝试直接附加到该容器。
https://stackoverflow.com/questions/7621048
复制相似问题