I'm making a Tumblr theme. I need to use JQuery for a few theme functions, but I need to first initialise it in the JS section of the built in theme editor.
Because this is on Tumblr, I cannot host a JQuery library on my own server. How can I access this library remotely from another source?
If you want to use the power of the jQuery javascript library in your Tumblr theme and you don’t want to host the jQuery library on your own server then you should consider the Google AJAX Libraries API. The AJAX Libraries API is a content distribution network and loading architecture for the most popular, open source JavaScript libraries.
Put the following snippet (based on this article) in the head tag of your theme and you’re ready to go:
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
google.setOnLoadCallback(function() {
jQuery(function($) {
// do some stuff here, eg load your tweets, ...
});
});
</script>