Jquery-mobile-dialogs-styling-theming
提供:Dev Guides
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.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>
<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_themingl ファイルとしてサーバーのルートフォルダーに保存します。
- このHTMLファイルをhttp://localhost/style_theminglとして開くと、次の出力が表示されます。