2012-09-21 34 views
1

我需要能够滚动使用jquery移动设备的元素。如何在jquery mobile中启用垂直滚动

例如现在我在表格中有很多数据。 和我的页面显示了20条记录,我知道有25条记录,所以当我想垂直滚动时,整个页面正在移动,而不是我的表格。

我正在使用DataTables插件的表。

代码:

<table id="level" width="100%" border="1" cellspacing="2" cellpadding="5" > 
       <thead> 
        <tr class="even"> 
         <th></th> 
         <th><span class="time_var">Time</span></th> 
         <th><span class="id_level_var">ID Level</span></th> 
         <th><span class="level_var">Level</span></th> 
        </tr> 
       </thead> 

       <tbody> 
       </tbody> 
     </table> 

和Javascript:

$(document).ready(function() { 
     oTable = $('#level').dataTable({ 
      "bLengthChange": false, 
        "aaSorting": [[1,'asc']], 
      "bProcessing": true, 
      "bServerSide": true, 
      "sPaginationType": "full_numbers", 
      "sScrollY": "500px", 
      "bDeferRender": true, 
      "sAjaxSource": "table.php" 
     }); 

回答

0

你尝试过:

<div style="width:260px; overflow:scroll" > 
    //your dataTable 
</div> 
0

缺少

}); 

捕捉你的document.ready?

$(document).ready(function() { 
    oTable = $('#level').dataTable({ 
     "bLengthChange": false, 
       "aaSorting": [[1,'asc']], 
     "bProcessing": true, 
     "bServerSide": true, 
     "sPaginationType": "full_numbers", 
     "sScrollY": "500px", 
     "bDeferRender": true, 
     "sAjaxSource": "table.php" 
    }); 
}); 

你的代码是在这里工作: http://live.datatables.net/otihog/edit#javascript,html