ui-modals.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var UIModals = function () {
  2. var initModals = function () {
  3. $.fn.modalmanager.defaults.resize = true;
  4. $.fn.modalmanager.defaults.spinner = '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><img src="assets/img/ajax-modal-loading.gif" align="middle">&nbsp;<span style="font-weight:300; color: #eee; font-size: 18px; font-family:Open Sans;">&nbsp;Loading...</div>';
  5. var $modal = $('#ajax-modal');
  6. $('#modal_ajax_demo_btn').on('click', function(){
  7. // create the backdrop and wait for next modal to be triggered
  8. $('body').modalmanager('loading');
  9. setTimeout(function(){
  10. $modal.load('ui_modals_ajax_sample.html', '', function(){
  11. $modal.modal();
  12. });
  13. }, 1000);
  14. });
  15. $modal.on('click', '.update', function(){
  16. $modal.modal('loading');
  17. setTimeout(function(){
  18. $modal
  19. .modal('loading')
  20. .find('.modal-body')
  21. .prepend('<div class="alert alert-info fade in">' +
  22. 'Updated!<button type="button" class="close" data-dismiss="alert"></button>' +
  23. '</div>');
  24. }, 1000);
  25. });
  26. }
  27. return {
  28. //main function to initiate the module
  29. init: function () {
  30. initModals();
  31. }
  32. };
  33. }();