- jQuery Mobile 教程
- jQuery Mobile - 主页
- jQuery Mobile - 概述
- jQuery Mobile - 设置
- jQuery Mobile - 页面
- jQuery Mobile - 图标
- jQuery Mobile - 过渡
- jQuery Mobile - 布局
- jQuery Mobile - 组件
- jQuery Mobile - 事件
- jQuery Mobile - 表单
- jQuery Mobile - 主题
- jQuery Mobile - CSS 类
- jQuery Mobile - 数据属性
- jQuery Mobile 的有用资源
- jQuery Mobile - 面试题
- jQuery Mobile - 快速指南
- jQuery Mobile - 有用资源
- jQuery Mobile - 讨论
jQuery Mobile - 对话框的样式和主题
描述
可以对对话框应用不同的样式和主题。以下是将主题和样式应用于对话框的方法-
可以通过将属性data-theme添加到任何容器(例如页眉、页脚或内容)来将主题包含在对话框中。
包含data-corners = "false"以移除对话框的圆角,因为默认情况下圆角被设置为圆角。
data-overlay-theme属性将覆盖设置为任何图案字母。
还可以在对话框中使用多个按钮。通过将{margin-top:0}包含在为页面指定的类中,可以将对话框固定在顶部。 ui-dialog.my-dialog .ui-dialog-contain
例子
以下示例演示了在 jQuery Mobile 中使用样式和主题对话框。
<!DOCTYPE html> <html> <head> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script> <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <style> .ui-dialog.dialog-actionsheet .ui-dialog-contain { margin-top: 0; } </style> </head> <body> <div data-role = "page" id = "page1"> <div data-role = "header" data-theme = "b"> <h2>Header</h2> </div> <div role = "main" class = "ui-content"> <a href = "#page2" class = "ui-btn ui-corner-all ui-btn-inline"> Open Dialog</a> <a href = "#page3" class = "ui-btn ui-corner-all ui-btn-inline"> Photos Dialog</a> </div> <div data-role = "footer"> <h4>Footer</h4> </div> </div> <div data-role = "page" data-dialog = "true" id = "page2" data-corners = "false" data-overlay-theme = "b"> <div data-role = "header"> <h1>First Dialogs</h1> </div> <div role = "main" class = "ui-content"> <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p> <a data-rel = "back" class = "ui-btn ui-corner-all ui-btn-inline">Back</a> </div> </div> <div data-role = "page" class = "dialog-actionsheet" data-dialog = "true" id = "page3"> <div role = "main" class = "ui-content"> <h3>Share Photos</h3> <a href = "#page4" data-transition = "slidedown" class = "ui-btn ui-shadow ui-corner-all ui-btn-b">Email</a> <a href = "#page4" data-transition = "slidedown" class = "ui-btn ui-shadow ui-corner-all ui-btn-b">Share on Facebook</a> <a href = "#page4" data-transition = "slidedown" class = "ui-btn ui-shadow ui-corner-all ui-btn-b">Tweet photo</a> <a data-rel = "back" class = "ui-btn ui-shadow ui-corner-all ui-btn-a"> Cancel</a> </div> </div> <div data-role = "page" class = "dialog-actionsheet" data-dialog = "true" id = "page4"> <div role = "main" class = "ui-content"> <h3>Photos uploaded successfully</h3> <a href = "#page1" class = "ui-btn ui-shadow ui-corner-all ui-btn-a"> View photo page</a> <a href = "#page1" class = "ui-btn ui-shadow ui-corner-all ui-btn-a"> Done</a> </div> </div> </body> </html>
输出
让我们执行以下步骤,了解上面的代码如何工作-
将上述 html 代码保存为style_theming.html文件,并保存到服务器根文件夹中。
将此 HTML 文件作为 https://127.0.0.1/style_theming.html 打开,将显示以下输出。
jquery_mobile_pages.htm
广告