JS Helpers‹ Back
There is also the
Ornament.C shorthand namespace for convenience.
For example you can pop open the TrayNav programatically with
Ornament.C in your console to see what you have available to you.
You can view a list of supported features that Ornament looks for by executing this command:
There are some basic feature detection booleans available:
You can tell the browser to try and preload assets using
Ornament.assetPreloader([ "/assets/image1.jpg", "/assets/image2.jpg" ]);
You can return a browser-agnostic window dimensions using the following functions:
Measuring an element while it's hidden
Measuring an element can be tricky while it's hidden. This function will clone the element off the browser canvas, measure a dimension and then remove the clone:
For example, if I had a
<div id="test" /> and wanted to measure it's height, I would use:
Scroll to an Y co-ordinate smoothly by using:
eg. Scroll 200px from the top of the page: