Last active
November 5, 2015 15:55
-
-
Save THEtheChad/53a45507fa629d9ff399 to your computer and use it in GitHub Desktop.
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
| /** | |
| * "reinitilizes" bootstrap on the jQuery | |
| * object passed in | |
| * | |
| * @param {object} jQuery | |
| * @param {string} url to retrieve the bootstrap source | |
| */ | |
| function bindBootstrap($target, source){ | |
| if(!source){ | |
| $target('script').each(function(){ | |
| if(!/bootstrap/i.test(this.src)) return; | |
| source = this.src; | |
| return false; | |
| }); | |
| } | |
| // Bootstrap can only be reinitialized | |
| // by reloading the script | |
| $target.get(source, function(raw_js){ | |
| // bootstrap binds itself to whatever | |
| // library is assigned to the `jQuery` | |
| // variable. | |
| var temp = jQuery; | |
| jQuery = $target; | |
| $target('<script>') | |
| .html(raw_js) | |
| .appendTo('head'); | |
| // restore jQuery to the original version | |
| jQuery = temp; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment