UI ELEMENTS
Thousands of words, made easy
Images are an essential comunication tool and as such, Ink provides a few simple styling and functional solutions to handle them in a semantic fashion.
Class name | Description |
---|---|
ink-image |
The image root class. |
over-top |
Places the caption over the top of the image. |
over-bottom |
Places the caption over the bottom of the image. |
dark |
Applies a white text on a dark background theme to the caption. |
imagequery |
Identifies images that will be handled by the Ink.UI.ImageQuery component. |
We chose to make use of HTML5 tags, so the markup structure for our image element is:
Structure
When dealing with multiple devices, one major concern should be asset size optimization. So Ink gives you a way to serve images with the appropriate size to your client devices.
This is done with our Ink.UI.ImageQuery JavaScript component, that'll detect the screen size and serve a larger version of the image if required.
By default we'll load the smallest image to save quota for mobile phones and tablets.
Javascript
In the script above the src
property sets the image base path. It can be relative or absolute. The rest of the url is a template that translates into properties of the queries
array.
In the example above {:label}
will be a folder under the base path, and {:file}
is the filename, which in this case defaults to the original file name.
Ink.UI.ImageQuery will then look at the queries.width
property and the device screen width and decide if a larger image should be served to the device by rewriting the src
attribute.