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();
});
I have used jScrollPane on my site. I'm also using ajax to update the data on the same div where the jScrollPane is used. Now, when i append the returned data to the div, the scrollbar is not visible on the appended text. It may because the jQuery function is called when the document loads but now any ideas to solve this problem? I read the article here here http://jscrollpane.kelvinluck.com/auto_reinitialise.html but i'm not being able to solve this problem. Here's the code:
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();
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否有充分的理由不使用 jQuery 的 $.ajax,因为我相信您在函数中创建的所有处理程序和函数都已内置于 $.ajax 中。
jspPane 通常是 jScrollPane 创建的容器,尝试直接附加到该容器。
Is there a good reason for not using jQuery's $.ajax, as I believe all the handlers and functions you are creating in your function is already built in to $.ajax.
jspPane is normally the container created by jScrollPane, try appending directly to that container.