Use the function
chi.drawer(elem) to instantiate a new drawer component in the DOM
element passed as a parameter. You must use the trigger element as the parameter.
Drawer components have a dispose function to free all resources attached to the element, such as event listeners and object data. You should call this method when you want to remove the component.
var elem = document.getElementById('drawer-1'); var drawer = chi.drawer(elem); // do stuff drawer.dispose();
TipIt is safe to call the
drawer method more than once, as it will return any previously created drawer component
associated to the trigger.
var elem = document.getElementById('drawer-2'); var drawer = chi.drawer(elem); var elem2 = document.getElementById('drawer-2'); var drawer2 = chi.drawer(elem2); drawer === drawer2; // returns true drawer.dispose(); // Only have to do it once.