jQuery Mobile - 预设断点
描述
要堆叠低于 35em (560px) 的网格,可以应用预设断点。 在网格容器中包含 .ui-responsive 类。
示例
以下示例演示了在 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>Two Column Responsive Example</h2> <div class = "ui-grid-a ui-responsive"> <div class = "ui-block-a"> <div class = "ui-body ui-body-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-body ui-body-b">Second Block</div> </div> </div> <h2>Three Column Responsive Example</h2> <div class = "ui-grid-b ui-responsive"> <div class = "ui-block-a"> <div class = "ui-body ui-body-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-body ui-body-b">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-body ui-body-a">Third Block</div> </div> </div> <h2>Four Column Responsive Example</h2> <div class = "ui-grid-c ui-responsive"> <div class = "ui-block-a"> <div class = "ui-body ui-body-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-body ui-body-b">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-body ui-body-a">Third Block</div> </div> <div class = "ui-block-d"> <div class = "ui-body ui-body-b">Fourth Block</div> </div> </div> <h2>Five Column Responsive Example</h2> <div class = "ui-grid-d ui-responsive"> <div class = "ui-block-a"> <div class = "ui-body ui-body-a">First Block</div> </div> <div class = "ui-block-b"> <div class = "ui-body ui-body-b">Second Block</div> </div> <div class = "ui-block-c"> <div class = "ui-body ui-body-a">Third Block</div> </div> <div class = "ui-block-d"> <div class = "ui-body ui-body-b">Fourth Block</div> </div> <div class = "ui-block-e"> <div class = "ui-body ui-body-a">Fifth Block</div> </div> </div> </body> </html>
输出
让我们执行以下步骤,看看上面的代码是如何工作的 −
将上述 html 代码保存为服务器根文件夹中的 breakpoint_preset.html 文件。
将此 HTML 文件打开为 http://localhost/breakpoint_preset.html,将显示以下输出。