This is an example from the Nemikor Blog article Building stateful jQuery plugins.
View the demo source and the plugin source to see what's going on.