weblinc/jquery.smoothState.js — pull request #113 by neon64 (2014-12-08 04:34:22+00:00)
Title: Added `root` option and made `bindEventHandlers` public

The `root` option determines where the `click`, `mouseover` and `touchstart` events should be bound to. This allows links outside of the $container to load using SmoothState.js.

`root` can be used like so:

$("#page").smoothState({
root: $(document)
}).data('smoothState');

`bindEventHandlers` has been made public to allow the user to manually rebind all events. For example: if `$("*").off()` has been called, and all event handlers have been destroyed, then it is necessary to re bind SmoothState's events.

An example from one of my projects:

render: function(url, container, content) {
$("html, body").css('cursor', 'auto')
.find('a').css('cursor', 'auto');
container.html(content)
elements = $(document).add("*")
elements.off() // removes all previous events to stop double registration when calling `initialisePage()`
smoothState.bindEventHandlers($(document))
initialisePage()
}

Hopefully you find these additions useful!