src/cm/media/js/lib/yui/yui3.0.0/examples/imageloader/imageloader-basics_clean.html
author Yves-Marie Haussonne <ymh.work+github@gmail.com>
Fri, 09 May 2014 18:35:26 +0200
changeset 656 a84519031134
parent 0 40c8f766c9b8
permissions -rw-r--r--
add link to "privacy policy" in the header test


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Basic Features of the ImageLoader Utility</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-debug.js"></script>

<!--there is no custom header content for this example-->

</head>

<body class=" yui-skin-sam">

<h1>Basic Features of the ImageLoader Utility</h1>

<div class="exampleIntro">
	<p>Displayed here are the basic abilities of the <a href="http://developer.yahoo.com/yui/imageloader/">ImageLoader Utility</a>. Images are loaded only after triggers are fired or time limits are reached.</p>

<p>Hover over each image to show its triggers and its time limit. Try tripping the triggers to see the load reactions. Refresh the page to reset the images.</p>

			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<style>

.everything { position:relative; height:420px; }
.everything div { border:1px solid #888; }
.topmain { position:absolute; top:10px; left:120px; height:75px; width:100px; }
.duo1 { position:absolute; top:130px; left:20px; height:67px; width:100px; }
.duo2 { position:absolute; top:130px; left:220px; height:53px; width:100px; }
.png { position:absolute; top:240px; left:140px; height:34px; width:61px; }
.scroll { position:absolute; top:320px; left:120px; height:72px; width:100px; }

</style>


<div class='everything' id='everything'>
	<div class='topmain' id='topmain' title='group 1; mouse over image; 2 sec limit'></div>
	<div class='duo1' id='duo1' title='group 2; mouse over left image, or click on right image; 4 sec limit'></div>
	<div class='duo2' id='duo2' title='group 2; mouse over left image, or click on right image; 4 sec limit'></div>
	<div class='png' id='pngimg' title='group 3; no trigger; 5 sec limit'></div>
	<div class='scroll' title='group 4; scroll; no time limit'>
		<img id='scrollImg' style='visibility:hidden;' />
	</div>
</div>


<script>

YUI({base:"../../build/", timeout: 10000, filter:"debug", logInclude: {imageloader:true, example:true}}).use("imageloader", function(Y) {

	var mainGroup = new Y.ImgLoadGroup({ name: 'group 1', timeLimit: 2 });
	mainGroup.addTrigger('#topmain', 'mouseover');
	mainGroup.registerImage({ domId: 'topmain', bgUrl: 'http://developer.yahoo.com/yui/docs/assets/examples/exampleimages/small/museum.jpg' });

	var duoGroup = new Y.ImgLoadGroup({ name: 'group 2', timeLimit: 4 });
	duoGroup.addTrigger('#duo1', 'mouseover').addTrigger('#duo2', 'click');
	duoGroup.registerImage({ domId: 'duo1', bgUrl: 'http://developer.yahoo.com/yui/docs/assets/examples/exampleimages/small/uluru.jpg' });
	duoGroup.registerImage({ domId: 'duo2', bgUrl: 'http://developer.yahoo.com/yui/docs/assets/examples/exampleimages/small/katatjuta.jpg' });

	var pngGroup = new Y.ImgLoadGroup({ name: 'group 3', timeLimit: 5 });
	pngGroup.registerImage({ domId: 'pngimg', bgUrl: 'http://l.yimg.com/a/i/us/nws/weather/gr/47s.png', isPng: true });

	var scrollGroup = new Y.ImgLoadGroup({ name: 'group 4' });
	scrollGroup.addTrigger(window, 'scroll');
	scrollGroup.registerImage({ domId: 'scrollImg', srcUrl: 'http://developer.yahoo.com/yui/docs/assets/examples/exampleimages/small/morraine.jpg', setVisible: true });

});

</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>