jqModal窗口中的jScrollPane仅在第一次工作

时间:2011-12-19 14:54:51

标签: jquery jscrollpane jqmodal

我正在尝试将jScrollPane plugin添加到我的jqModal窗口,以便当我加载高于我的设置高度(600px)的内容(通过AJAX)时,滚动窗格可以完成它的工作。问题是预期的结果只在第一次出现。对TEST链接的每个后续请求都会在jqModal窗口中加载数据,但是jScrollPane不会被加载,但是没有错误或警告说出现了问题。所以....这里是一些代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>test</title>
        <link rel="stylesheet" media="screen" type="text/css" href="/css/jqmodal.css" />
        <link rel="stylesheet" media="screen" type="text/css" href="/css/jquery.jscrollpane.css" />
        <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="/js/jqmodal.js"></script>
        <script type="text/javascript" src="/js/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="/js/mwheelIntent.js"></script>
        <script type="text/javascript" src="/js/jquery.jscrollpane.min.js"></script>
        <script type="text/javascript">
            $('document').ready(function() {
                var myShow = function(hash){ hash.w.fadeIn('2000',function(){ hash.o.show(); }); };
                var myHide = function(hash){ hash.w.fadeOut('2000',function(){ hash.o.remove(); $('#loading').show(); }); };
                var myLoad = function(){ $('#loading').hide(); $('#window_content').jScrollPane({showArrows: true}); };
                $('#window').jqm({
                    modal: false,
                    trigger: '.link',
                    target: '#window_content',
                    ajax: '@href',
                    onShow: myShow,
                    onHide: myHide,
                    onLoad: myLoad
                });
            });
        </script>
    </head>
    <body>
        <div id="window" class="jqmWindow">
            <a href="#" class="jqmClose">Close</a>
            <div id="loading">Loading...</div>
            <div id="window_content"></div>
        </div>
        <a class="link" href="test.php">TEST</a>
    </body>
</html>

test.php仅仅是:

<div>This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data. This is some test data.</div>

帮助stackoverflow的用户。你是我唯一的希望。

1 个答案:

答案 0 :(得分:1)

啊哈哈!如果我早点找到文档,我就不用发帖了。对于那些可能经历过类似事情的人。先阅读DOCS!大声笑但是对于这个例子,这是解决方案。在 myHide 功能中,我只需添加:

$('#window_content').jScrollPane().data().jsp.destroy();

因此,它会在后续调用中正确重新初始化。再次感谢我!你是受欢迎的,但是再次......首先阅读文档! :P(Docs | Destroy