2011-12-19 54 views
0

我想將jScrollPane plugin添加到我的jqModal窗口中,這樣當我加載比我設置的高度(600px)更高的內容時(通過AJAX),滾動窗格可以完成工作。問題是預期的結果只是第一次發生。對TEST鏈接的每個後續請求都會將數據加載到jqModal窗口中,但jScrollPane不會加載,但沒有錯誤或警告表明出現了問題。所以....下面是一些代碼: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的僅僅consits的:

<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> 

幫助我的用戶計算器的。你是我唯一的希望。

回答

1

啊哈!如果我只是早日發現文檔,我就不必發佈。對於那些可能經歷過類似事情的人。先閱讀文檔!大聲笑但是對於這個例子,這裏是解決方案。在myHide功能我不得不補充:

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

,以便它在後續調用重新初始化正確。再次感謝我!你不受歡迎,但是......再次閱讀文檔! :P(Docs | Destroy