var UIExtendedModals = function () { return { //main function to initiate the module init: function () { // general settings $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner = '
' + '
' + '
' + '
' + '
'; $.fn.modalmanager.defaults.resize = true; //dynamic demo: $('.dynamic .demo').click(function(){ var tmpl = [ // tabindex is required for focus '' ].join(''); $(tmpl).modal(); }); //ajax demo: var $modal = $('#ajax-modal'); $('#ajax-demo').on('click', function(){ // create the backdrop and wait for next modal to be triggered $('body').modalmanager('loading'); setTimeout(function(){ $modal.load('ui_extended_modals_ajax_sample.html', '', function(){ $modal.modal(); }); }, 1000); }); $modal.on('click', '.update', function(){ $modal.modal('loading'); setTimeout(function(){ $modal .modal('loading') .find('.modal-body') .prepend('
' + 'Updated!' + '
'); }, 1000); }); } }; }();