jScrollPane故障 [英] jScrollPane Trouble

查看:85
本文介绍了jScrollPane故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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();
});

推荐答案

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

是否有充分的理由不使用jQuery的$ .ajax,因为我相信您在函数中创建的所有处理程序和函数已经内置在$ .ajax中.

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.

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

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

jspPane is normally the container created by jScrollPane, try appending directly to that container.

这篇关于jScrollPane故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆