Displayed here are some basic triggers of the ImageLoader Utility. Each image group has an assigned action that will make the group of image(s) appear.
This will appear two seconds after page-load.
<div id='delay' title='Group 1: 2 sec limit'></div>
var delayGroup = new Y.ImgLoadGroup({ timeLimit: 2 }); delayGroup.registerImage({ domId: 'delay', bgUrl: '../assets/imageloader/yui-logo.png', isPng: true });
This will appear when the scroll event is fired.
<img id='scroll' style='visibility:hidden;' />
var scrollGroup = new Y.ImgLoadGroup(); scrollGroup.registerImage({ domId: 'scroll', srcUrl: '../assets/imageloader/yui-logo.png', isPng: true, setVisible: true }); scrollGroup.addTrigger(window, 'scroll');
This will appear when you mouse over it.
<div id='mouseover' title='Group 3: mouseover'></div>
var mouseoverGroup = new Y.ImgLoadGroup(); mouseoverGroup.registerImage({ domId: 'scroll', srcUrl: '../assets/imageloader/yui-logo.png', isPng: true, setVisible: true }); mouseoverGroup.addTrigger(window, 'scroll');
These will appear when either one is clicked.
<div id='duo1' title='Group 4: onclick'></div> <div id='duo2' title='Group 4: onclick'></div>
var clickGroup = new Y.ImgLoadGroup(); clickGroup.registerImage({ domId: 'duo1', bgUrl: '../assets/imageloader/yui-logo.png', isPng: true }); clickGroup.registerImage({ domId: 'duo2', bgUrl: '../assets/imageloader/yui-logo.png', isPng: true }); clickGroup.addTrigger('#duo2', 'click').addTrigger('#duo1', 'click');