jmpressjs / jmpress.js

A jQuery plugin to build a website on the infinite canvas
http://jmpressjs.github.com/jmpress.js
1.5k stars 237 forks source link

allow multiple callback handlers #6

Closed sokra closed 12 years ago

sokra commented 12 years ago

here ist some small change.

This tweek allows multiple handlers to be attached to a callback/event. It also allows handlers to be attached before init is called. This will add a simple plugin feature. (More events are required to create useful plugins. I will add these if this commit is merged in)

Some sample code:

// some kind of plugin
$.jmpress( 'beforeChange', function( slide ) {
  // do some cool stuff
});
$("#jmpress").jmpress(...);
$("#jmpress").jmpress( 'beforeChange', function( slide ) {
  // Handler 1
});
$("#jmpress").jmpress( 'beforeChange', function( slide ) {
  // Handler 2
});
shama commented 12 years ago

This is awesome! Thank you much sir!