但是,我的 Jquery 模态运行完美,当我单击一个不应该关闭模态的按钮时,它会关闭模态吗?难道是按钮正在自动刷新页面导致模式关闭?我怎样才能克服这个当前的问题?
这是脚本:
<script>
$(document).ready(function () {
var triggers = $(".modalInput").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#F7F7F7',
loadSpeed: 200,
opacity: 0.9
},
closeOnClick: false
});
var buttons = $("#yesno button").click(function (e) {
// get user input
var yes = buttons.index(this) === 0;
// do something with the answer
triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
});
});
</script>
这是按钮(触发器):
<asp:Button class="modalInput" rel="#yesno" ID="modalInput" runat="server" BackColor="#525663" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="1pt" CommandName="MoveNext" Font-Size="Large"
ForeColor="White" Style="font-family: Segoe UI; margin-left: 0px; position: relative;
top: 25px; left: -25px; width: 152px; height: 41px;" Text="Edit Information" />
这是模态:
<div class="modal" id="yesno">
<h2>Edit Account Information:</h2>
<Uc2:EditCurrentSet ID="EditCurrentSet" runat="server" />
<a class="close"></a>
</p></div>
*我是否将返回错误;在正确的地方?:如果我在,结果仍然没有变化!*
<script>
$(document).ready(function () {
var triggers = $(".modalInput").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#F7F7F7',
loadSpeed: 200,
opacity: 0.9
},
closeOnClick: false
});
var buttons = $("#yesno button").click(function (e) {
// get user input
var yes = buttons.index(this) === 0;
// do something with the answer
triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
return false;
});
return false;
});
</script>