From: Chris Oyler Date: Mon, 4 Jan 2016 22:50:33 +0000 (-0800) Subject: updates interchange docs to demonstrate programmatic use X-Git-Tag: v6.1.2~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f5e014aa3ec6ec8cf4aecd6ee523aff25ff78fd;p=thirdparty%2Ffoundation%2Ffoundation-sites.git updates interchange docs to demonstrate programmatic use --- diff --git a/docs/pages/interchange.md b/docs/pages/interchange.md index e88c85d18..842af5725 100644 --- a/docs/pages/interchange.md +++ b/docs/pages/interchange.md @@ -76,3 +76,14 @@ To add your own named media queries, add them as properties to `Foundation.Inter ```js Foundation.Interchange.SPECIAL_QUERIES['square'] = 'screen and (aspect-ratio: 1/1)'; ``` + +--- + +## Programmatic Use + +When using Interchange programmatically, you need to pass in your ruleset in the `options` object, as well as the *container* element, *not* the content elements, like so: + +```js +var $photoFrame = $('#some-container'); +var interchange = new Foundation.Interchange($photoFrame, {rules: "[path/to/default.jpg, small], [path/to/medium.jpg, medium], [path/to/large.jpg, large]"}); +```