以前は、jqueryダイアログを使用してポップアップメッセージを表示していました。ただし、プロジェクトにboostarpを使用する必要があり、実際にポップアップを表示する方法がわかりません。jqueryダイアログに使用したコード:
showUserWarningMessage: function (title, message, callback, scope, username) {
var $dialog = $("#dialog-move-user-warning");
$dialog.dialog({
resizable: false,
height: 450,
width: 580,
modal: true,
top: 200,
dialogClass: "warning-dialog",
title: title,
position: ["center", 200],
open: function () {
$dialog.find(".btn-default").on("click", function () {
$dialog.dialog("close");
});
$dialog.find(".btn-primary").on("click", function () {
$dialog.dialog("close");
if (callback) {
if (scope) {
callback.call(scope);
} else {
callback();
}
}
});
},
そして彼はブートストラップモーダルのためにim書き込みをコーディングします:
showAlertMessage: function(options) {
var $dialog = $("#dialog-move-user-warning");
$dialog.modal("show");
}
HTML:
<div class="modal fade" id="dialog-move-user-warning" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">User Info</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
オーバーレイがポップされているかのように背景が無効になりますが、何らかの理由で画面に何も表示されませんが、表示されます。に設定されているデフォルトを変更しようとしましたがclass="modal"
、役に立ちませんでした。何が間違っているのですか、またはオーバーレイを表示するために追加で必要なものはありますか?css
変更する必要があるものはありますか?前もって感謝します!
Bootstrapを使用してモーダルを表示したい場合は、Bootstrapを使用してみませんか?
1.モーダルHTMLをページに追加します。
提供したモーダルHTMLは有効です。不明な場合は、正確なコードとその他の例をここで見つけることができます:http://getbootstrap.com/javascript/#modals-examples
2.ページにトリガーを追加します。
データターゲットはモーダルIDと同じである必要があります。これは、この場合は#dialog-move-user-warningです。
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
3.Webサイトにbootstrap.jsとbootstrap.cssが含まれていることを確認します。
Bootstrapモーダルはbootstrap.jsに大きく依存しています。すべてが必要なわけではありません。以下のJSFiddleにあるもので十分です。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加