Created
December 19, 2016 14:55
-
-
Save YurePereira/17f67b53459dd87e41e4a39a5e0a8aeb to your computer and use it in GitHub Desktop.
Modal with bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var MyModal = (function() { | |
| var alert = function(options) { | |
| var modalConfirm = $('#modal_alert'), | |
| titleModal = modalConfirm.find('.title-modal') | |
| messageModal = modalConfirm.find('.message-modal'), | |
| buttonOk = modalConfirm.find('.model-button-ok'); | |
| titleModal.text(options.title); | |
| messageModal.text(options.message); | |
| buttonOk.text(options.buttonNo); | |
| if (options.open) { | |
| modalConfirm.modal('show'); | |
| } else { | |
| modalConfirm.modal('hide'); | |
| } | |
| }; | |
| var confirm = function(options) { | |
| var modalConfirm = $('#modal_confirm'), | |
| titleModal = modalConfirm.find('.title-modal') | |
| messageModal = modalConfirm.find('.message-modal'), | |
| buttonYes = modalConfirm.find('.model-button-yes'), | |
| buttonNo = modalConfirm.find('.model-button-no'); | |
| titleModal.text(options.title); | |
| messageModal.text(options.message); | |
| buttonYes.text(options.buttonYes); | |
| buttonNo.text(options.buttonNo); | |
| buttonYes.click(function() { | |
| options.callbackYes(modalConfirm); | |
| }); | |
| if (options.open) { | |
| modalConfirm.modal('show'); | |
| } else { | |
| modalConfirm.modal('hide'); | |
| } | |
| }; | |
| return { | |
| confirm: confirm, | |
| alert: alert | |
| }; | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment