Hi all,

I made a new plugin: jQuery history/remote.

http://stilbuero.de/jquery/history/
http://stilbuero.de/jquery/history/#remote-3

It's another one in the toolbox for all of you going for unobtrusive
JavaScript and progressive enhancement.
Test the page with JS disabled. The links point to existing resources
and do still work. In this example the links point to simple html
snippets, in real life you would probably return a complete page.

Say you have constructed a page working in the old-fashioned way. With
the plugin you can then easily hijax links in the page, load content
from their URL remotely via XHR and display it in a defined element.

It's as easy as this:

$('a.remote').remote('#chapter');

Before: <a href="chapter-1.html">Chapter 1</a>
After: <a href="#remote-1">Chapter 1</a>

remote() takes jQuery expressions as parameter (like appendTo). If no
element is found with that query, a <div> is created and appended to the
body to load the content into.

If a link already has a hash in the url the href is not altered but
the link is still registered for the history.

History is supported in Firefox/Safari/Opera and IE (still a little
clumsy in IE), so I dare to say it's the most complete solution for
jQuery so far. Credits go to Taku Sano and his history plugin - I
borrowed some of the code for making history work in IE.

I will improve history in IE and also (re)integrate history for the tabs.

Enjoy!


-- Klaus




_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to