jQuery Mobile - 多行网格
描述
通过在容器上指定任何列类,即 ui-grid-a, ui-grid-b, ui-grid-c, ui-grid-d, ui-grid-b,可以将多行包装在网格中。 重复将子容器包含在类 ui-block-a/b/c/d 中,以获得您想要的行数。
示例
以下示例演示了在 jQuery Mobile 中使用多行网格。
<!DOCTYPE html> <html> <head> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <h2>Multiple Row Grid Example</h2> <div class = "ui-grid-b"> <div class = "ui-block-a"> <div class = "ui-bar ui-bar-b">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-bar ui-bar-a">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-bar ui-bar-b">Third Block</div> </div> <div class = "ui-block-a"> <div class = "ui-bar ui-bar-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-bar ui-bar-b">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-bar ui-bar-a">Third Block</div> </div> <div class = "ui-block-a"> <div class = "ui-bar ui-bar-b">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-bar ui-bar-a">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-bar ui-bar-b">Third Block</div> </div> <div class = "ui-block-a"> <div class = "ui-bar ui-bar-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-bar ui-bar-b">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-bar ui-bar-a">Third Block</div> </div> </div> </body> </html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 multiple_row_grid.html 文件。
将此 HTML 文件打开为 http://localhost/multiple_row_grid.html,将显示以下输出。