I'm not sure if this can be done, but I appreciate some help. I have read the documentation for bootstrap 3 modal. I haven't seen an example of how to do what I'm trying to demo after the user clicks "save" button in a modal. I am trying to put up a demo that imitates content hiding and showing after a modal closes. Here is the pseudo code of the use case:
- User clicks
save
button on a page in the UI - Clicking
save
launches amodal
window - User clicks
save
button in the modal (usingdata-dismiss
attr on "save" btn) - Modal closes
- Page content (containing the first save button) that launched the modal fades out and different content fades in.
Is this possible? Not sure if I'm using correct method within modal (hidden.bs.modal
), or correct data-*
attribute or where href
should point within a
tag. Or if what I am trying to demo is even possible.
All content is on the same page which is set to display:none
, until I call fadeIn()
method on the hidden div containing the content I want to show after modal has closed, replacing the initial page content.
Below code is rudimentary and doesn't work, but hopefully if the use case above isn't clear, you can read what I am trying to do and help me out.
HTML
<a href="#" data-dismiss="modal" class="btn btn-primary savethis">Save</a>
<a href="#" data-dismiss="modal" class="btn btn-primary cancelthis">Cancel</a>
jQuery
$(".savethis").on("hidden.bs.modal", function(){
$("#currContent").fadeOut(function(){
$("#replacingContent").fadeIn("slow");
});
console.log("Modal has completely closed and old content replaced.");
});