[英]How to center align vertically a text in between two buttons inside a jQuery dialog box?
[英]How to put a text in between the buttons inside a modal dialog box in jQuery?
我想在使用jQuery的模態對話框框中的“登錄”和“ Sign_Up”按鈕之間放置文本。 怎么做? 並且,如何將某些錨標記與這些按鈕鏈接? 這是我的代碼段:任何幫助將不勝感激,謝謝。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#dialog_nav").dialog({
autoOpen: false,
modal: true,
dialogClass: "First_Dialog",
resizable: false,
buttons: {
"Login": function () {
$(this).dialog("close");
},
"SignUp": function () {
$(this).dialog("close");
}
}
});
$("#Dialog_Modal").on("click", function (event) {
$("#dialog_nav").dialog("open");
});
});
</script>
<style type="text/css">
.First_Dialog .ui-dialog-titlebar{
display:none;
}
.First_Dialog .ui-dialog-titlebar-close{
display:none;
}
</style>
</head>
<body>
<div id="dialog_nav" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<input type="button" id="Dialog_Modal" value="Click to open a modeless dialog" />
</body>
</html>
您可以嘗試添加自定義按鈕並根據需要更改其樣式。 碼:
鏈接: http : //jsfiddle.net/lotusgodkk/GCu2D/69/
Javascript:
$(function () {
$("#dialog_nav").dialog({
autoOpen: false,
modal: true,
dialogClass: "First_Dialog",
resizable: false,
buttons: [{
text: "Cancel",
"class": 'cancelButtonClass',
click: function () {
// Cancel code here
}
}, {
text: "Custom",
"class": 'custom',
click: function () {
// code here
}
}, {
text: "Cancel",
"class": 'cancelButtonClass',
click: function () {
// Cancel code here
}
}, ],
});
$("#Dialog_Modal").on("click", function (event) {
$("#dialog_nav").dialog("open");
});
});
HTML:
<div id="dialog_nav" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<input type="button" id="Dialog_Modal" value="Click to open a modeless dialog" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.