Ich bin auf dieses sehr schöne modale jQuery / Bootstrap-Plugin gestoßen:
http://nikku.github.com/jquery-bootstrap-scripting/
Als ich jedoch versuchte, das einfachste Beispiel zum Laufen zu bringen, stieß ich auf ein Problem
Mein von ihrer Site kopierter Dialog wird angezeigt, wenn die Seite zum ersten Mal geladen wird.
Html:
<a class="open-dialog" rel="sample1-dialog">trigger</a>
<div id="sample1-dialog" style="display: none">
<h1>Simple alert</h1>
<p>
It is always beneficial to acknowledge alerts of any kind.
You can close this alert if you agree.
(Note: Normally a dialog box is not that penetrating)
</p>
<div class="form-actions">
<button class="btn-primary close-dialog">Understood</button>
<button class="btn-danger" onclick="alert("You might reconsider your click behaviour!")">I don"t care</button>
</div>
</div>
jQuery:
$(function () {
$("#sample1-dialog").dialog2({
showCloseHandle: false,
removeOnClose: false,
autoOpen: false,
closeOnEscape: true,
closeOnOverlayClick: true
});
$(".open-dialog").click(function (event) {
event.preventDefault();
$("#sample1-dialog").dialog2("open");
});
Hier ist eine Geige, die das Problem zeigt:
Ich kann nicht glauben, dass dies ein Problem mit ihrem Code ist. Ihre Beispiele funktionieren einwandfrei.
Fehle ich etwas Offensichtliches?
Antworten:
0 für die Antwort № 1Das Update besteht darin, Zeile 26 von jquery.dialog2.js zu ändern:
var __DIALOG_HTML = "<div class="modal" style="display: none;">" +
https://github.com/Nikku/jquery-bootstrap-scripting/issues/50#issuecomment-7394968