Bookmarking and history in the jQuery API docs

Once again an interesting problem came up. Simon pointed out that it wasn't possible to link to specific functions in the jQuery API because of all the JS. Hmmm ... chewy.

My solution uses Mikage's history plugin, which binds events to url hash targets instead of directly to DOM events. This allows you to use those urls as shortcuts to the events.

The hash I was in the form [function_name](_[param_name])*, e.g. each_fn, load_url_params_callback. '$' and '.' can be in id's so I replaced all occurances of those with underscores.

In order to tie those hashes into the DOM, I also changed the XSLT so that a function's LI had the hash as it's id, and the url of the function links used that hash. Once that was done, I was able to tie the history plugin to the links so that:

  1. If the correct page wasn't displayed, it would be.
  2. The function discription display would be toggled.


Mouse gestures jQuery plugin

Someone was looking for a mouse gestures plugin on the jQuery list today. It seemed like an interesting problem, so I had a go at it. Here is the file by the way.

$().gesture(handler,buffer,onchange):

handler
Either a function or a hash of gesture-function mappings
buffer
The number of pixels the mouse has to move to trigger a new step in the gesture. Defaults to 25px.
onchange
Set to true to have the handler trigger when the gesture changes instead of when the user releases their mouse button. While onchange is true, returning false from the handler will stop the gesture. Defaults to false.

Blue will display the gesture once it is finished.

Green will display the gesture as it created

Red triggers one of two functions depending on the gesture - RDLU or LDRU.

Yellow will output the gesture and the content of the originating element.

 
test
 

As simple as it gets...

Welcome to my website.