Overly simple jQuery plugin to run per page Javascript.
JavaScript
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
README.rdoc
jquery.Page.js
jquery.Page.min.js

README.rdoc

jQuery.Page

author

Arwid Bancewicz arwid.ca

version

0.1

updated

23 Feb 2011

This is an overly simple jQuery plugin to run per page Javascript. Use it to reduce server load and page load time by allowing the browser to download your js once and cache it for subsequent page requests.

It becomes even more useful if you concatenate all js files (such as with Jammit) so you're loading one js across multiple pages. This plugin effectively becomes a simple and elegant js controller for routing pages and connecting them to js fragments.

Usage

Give the body an attribute:

<body id="home">

Setup the javascript:

$.Page.init({
  "home" : function() {
    // do something
  },
  "about" : function() {
    // do something
  }
});
$.Page.start();

Alternatively:

$.Page.addHandlers({
  "home" : function() {
    // do something
  }
});

License

jQUery.Page is covered by the MIT License.