Created
March 5, 2011 12:55
-
-
Save vaclavbohac/856334 to your computer and use it in GitHub Desktop.
Example of asynchronous loading of JS app.
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf8"/> | |
| <title>Testing of asynchronous loading</title> | |
| <script src="js/yepnope.1.0.0-min.js"></script> | |
| <script> | |
| (function (global, doc) { | |
| global.MyApp = { | |
| init: function () { | |
| var that = this; | |
| $(function () { | |
| that.createLinks(); | |
| }); | |
| }, | |
| createLinks: function () { | |
| $("#wrapper").find("span").each(function () { | |
| var elem = $(this); | |
| elem.parent().append($("<a>", { | |
| text: elem.html(), | |
| href: "#" | |
| })); | |
| elem.remove(); | |
| }); | |
| } | |
| }; | |
| }(this, this.document)); | |
| yepnope({ | |
| load: 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', | |
| callback: function () { | |
| MyApp.init(); | |
| } | |
| }); | |
| </script> | |
| </head> | |
| <body> | |
| <div id="wrapper"> | |
| <span>Home</span> | |
| <span>About</span> | |
| <span>Contact</span> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment