Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation updates #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Gumby Responsive Images

This module will preload and insert images based on media queries and/or feature detection. For more detailed documentation please check out the [Gumby docs](http://gumbyframework.com).


Installation
------------

A bower package is available to install this module into your project. We recommend using this method to install Gumby and any extra UI modules, however you can alternatively move the individuals files into your project.

$ bower install gumby-images

Include gumby.images.js in the same fashion as your other UI modules, after gumby.js and before gumby.init.js. In production you should minify JavaScript files into a single optimized gumby.min.js file, ensuring the order (gumby.js, UI modules, gumby.init.js) is retained.
Include `gumby.images.js` in the same fashion as your other UI modules, after `gumby.js` and before `gumby.init.js`. In production you should minify JavaScript files into a single optimized `gumby.min.js` file, ensuring the order (`gumby.js`, UI modules, `gumby.init.js`) is retained.


<!--
Include gumby.js followed by UI modules.
Expand All @@ -26,10 +28,11 @@ Include gumby.images.js in the same fashion as your other UI modules, after gumb
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>


Usage
-----

Using the responsive images module is simple. Add a `gumby-media` attribute to any element containing any number of comma separated media query / image path pairs. Media queries and their associated images should be separated with a pipe. You can also add a `gumby-supports` attribute to any element, containing any number of comma seaparted features / image path pairs, in the same format as `gumby-media`. Features will be tested with Modernizr so ensure your Modernizr build contains all the tests you require. Both `gumby-media` and `gumby-supports` will fallback to the image supplied in `gumby-default`. If applied to an `<img>` the `src` will be updated otherwise the `background-image` will be used.
Using the responsive images module is simple. Add a `gumby-media` attribute to any element containing any number of comma separated media query / image path pairs. Media queries and their associated images should be separated with a pipe. You can also add a `gumby-supports` attribute to any element, containing any number of comma separated features / image path pairs, in the same format as `gumby-media`. Features will be tested with Modernizr so ensure your Modernizr build contains all the tests you require. Both `gumby-media` and `gumby-supports` will fallback to the image supplied in `gumby-default`. If applied to an `<img>` the `src` will be updated otherwise the `background-image` will be used.

<img gumby-media="only screen and (max-width: 768px) and (min-width: 501px)|img/img_silence_demo-768.jpg,
only screen and (max-width: 500px)|img/img_silence_demo-500.jpg"
Expand All @@ -38,11 +41,12 @@ Using the responsive images module is simple. Add a `gumby-media` attribute to a
<img gumby-supports="webp|img/img_silence_demo.webp"
gumby-default="img/img_silence_demo.jpg" />


### Shorthand

The characters `<` and `>` can be used as shorthand for `max-width` and `min-width` to make it easier and less verbose.

For exampe, the following...
For example, the following...

<div gumby-media="< 768px | 2-1-0"></div>

Expand All @@ -67,5 +71,3 @@ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEM
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.