jScrollPane в окне jqModal работает только в первый раз - PullRequest
0 голосов
/ 19 декабря 2011

Я пытаюсь добавить плагин jScrollPane в мое окно jqModal , чтобы при загрузке содержимого (через AJAX), которое было выше, чем моя заданная высота (600 пикселей), панель прокрутки могла делай это работа Проблема в том, что ожидаемые результаты появляются только в первый раз. каждый последующий запрос к ссылке 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 Ответ

1 голос
/ 19 декабря 2011

Ах, ха! Если бы я только нашел документацию раньше, мне бы не пришлось публиковать. Для тех, кто, возможно, испытал нечто подобное. ПРОЧИТАЙТЕ ДОКУМЕНТЫ ПЕРВЫМИ! lol Но для этого примера вот решение. В функции myHide мне просто нужно было добавить:

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

Чтобы он правильно инициализировался при последующих вызовах. Еще раз спасибо мне! Не за что, но снова ... ПРОЧИТАЙТЕ ДОКУМЕНТЫ ПЕРВЫМИ! : P ( Документы | Уничтожить )

...