Ink comes with a highly powerful and completely modular JavaScript library packed full of browser whipping goodness.
Introduction
Our JavaScript library has a modular architecture and is organized into namespaces:
Ink - The core module. Provides common methods used by all other modules.
Ink.Dom - Provides DOM manipulation methods, event management, form serialization, etc
Ink.Net - Ajax and JsonP request handling
Ink.UI - User interface components.
Ink.Util - Utility methods.
Ink.Ext - Reserved for community contributions.
Ink UI Components
The UI namespace (Ink.UI.*) contains visual components that allow you to enhance your pages with interactivity, like carousels, modal windows, tooltips, etc. UI components can be used in two ways:
Recommended for people less comfortable with javascript. This method is the easiest, but gives you a bit less flexibility. You can use Ink.Autoload to create the UI components by adding classes to the DOM, and data-attributes to pass options.
All configuration options, except callback functions, are available as data-attributes but are prefixed with data- and are written in lowercase and hyphen separated: someOption = data-some-option.
Code
Using raw JavaScript
Code
CDN
If you don't want or need to host Inks code you can use our CDN (generously provided by Fastly). All of our releases are available:
ink.js - Contains: Ink, Ink.Dom, Ink.Net and Ink.Util modules. Minified version available: ink.min.js
ink-ui.js - Contains the Ink.UI module. Minified version available: ink-ui.min.js
ink-all.js - ink.js and ink-ui.js bundled together. Minified version available: ink-all.min.js
autoload.js - UI component automatic initialization. Use with ink-all.js.
modernizr.js - Used for browser feature detection, mainly useful if you intend to use our flex grid.
Ink.requireModules
The Ink.requireModules() method is our implementation of AMDs require pattern. It handles dependency loading, provides aliases for modules and a callback function that gets executed. We recommend that you use it.
As you'll see throughout our documentation, the provided examples use Ink.requireModules(). Don't worry you don't have to use with every method invocation, but wrapping you code in its callback function will keep your code isolated and the DOMs global scope clean of clutter.
Example
Ink.Ext
The Ink.Ext is a special namespace. It was created to allow the community to contribute with new modules or components. These contributions may eventually be integrated into Inks core. Read more on how to contribute on our Github repository.
To create your own extension use the Ink.createExt(). Your extension will become available under the Ink.Ext namespace.
Note: this only applies to UI-related javascript components, such as the ones you find in the Ink.UI namespace. The remaining components are created just with Ink.createExt, as seen above.