Created
August 3, 2015 09:46
-
-
Save borantula/7e91f79d463434b7b122 to your computer and use it in GitHub Desktop.
Bootstrap Modal Control Class for easy usage
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
BootstrapModalControl = { | |
init : function(){ | |
//for necessary binding | |
}, | |
modelBox : function(){ | |
//this could be dynamic if you have more than one modal | |
return $('#admin-modal'); | |
}, | |
open : function(){ | |
this.clearContent(); | |
this.modelBox().modal(); | |
return this; | |
}, | |
content : function(html){ | |
this.modelBox().find('.modal-body').html(html); | |
return this; | |
}, | |
clearContent : function(){ | |
this.content(''); | |
}, | |
close : function(){ | |
this.modelBox().modal('hide'); | |
this.clearContent(); | |
return this; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment