I have a modal popup which contains a View Details button that opens a different modal popup. I'm using $('#modalName').foundation('reveal', 'close')
everywhere and it works very well. But in this case, I believe there is an event issue going on, because the modal closes but control never returns to the window.
This is the modal I want to close:
Notice the red box around the Done button and the X (close). I want the same code to execute no matter which way the user closes the popup.
CSHTML
@*The Modal View for Displaying Meter Tag Details*@
<div id="meterTagDetailsModal" class="reveal-modal medium">
<div class="row modalTitleRow">
<div class="small-12 columns">
<h3>
Meter Tags Details
</h3>
</div>
</div>
<br />
<div class="row meterRow">
<div class="small-12 columns">
<table id="meterTagDetailsTable" class="meterTable">
<thead>
<tr>
<th>Meter Name</th>
<th>Commodity</th>
<th>Building Name</th>
<th>Site</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<a id="closeModal" class="close-reveal-modal">×</a>
</div>
<div class="row meterRow">
<div class="small-12 columns text-right">
<a class="button tiny" onclick="$('#closeModal').click()">Done</a>
</div>
</div>
</div>
JavaScript
Bind event
$('#meterTagDetailsModal').on("closed", onCloseMeterTagDetails);
Method
onCloseMeterTagDetails = function () {
$('#meterTagDetailsModal').foundation('reveal', 'close');
$('#meterTagDetailsModal').trigger('reveal: close');
}
Execution gets into this method when the popup closes. But the view is stuck in limbo. I've tried both of the statements shown.
Does anybody know how I can get the view to close and return control to the window?
来源:https://stackoverflow.com/questions/49161370/zurb-foundation-4-closed-modal-gets-stuck