Created
January 31, 2013 13:44
-
-
Save snichme/4682964 to your computer and use it in GitHub Desktop.
Head.js example
This file contains 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
<script> | |
head.ready(function() { | |
// Use your javascript here... | |
// Load a new js file: | |
head.js("path/to/file.js", function() { | |
// here the new script is available | |
}); | |
// Or use jQuery | |
$("a.ajax").click(function(){ | |
var o = $(this), | |
url = o.attr("href"); | |
url = url.substr(0, url.lastIndexOf("#")); | |
console.log(this.hash, url); | |
$(this.hash).load(url); | |
return false; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment