aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/fx/tests/example_backgroundPosition.html
blob: 5011213bb785d55d1c9d97ca9de711ec0c9e31d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>Animated background position example | The Dojo Toolkit</title>
		
	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true" ></script>
	<style type="text/css">
		@import "../../../dojo/resources/dojo.css";
		@import "../../../dijit/themes/dijit.css";
		@import "../../../dijit/themes/tundra/tundra.css";
		@import "../../../dijit/tests/css/dijitTests.css";

		#theNode {
			background:#dedede url('images/longBg.png') 0px 0px;
			padding:3px 10px 3px 10px; 
			border:1px solid #b7b7b7;
			color:#666;
			cursor:pointer; 
		}
	
	</style>
	<script type="text/javascript">
		dojo.require("dojo.fx");
		var anim = null; 
		var init = function(){
			var node = dojo.byId('theNode');
			anim = new dojo._Animation({
				curve: new dojo._Line(0,-500),
				duration: 3000,
				onEnd: (function(){ anim.play(); }), // loop indefinately
				onAnimate: function(){
					var str = Math.floor(parseInt(arguments[0]))+"px 0px";
					dojo.style(node,"backgroundPosition",str);
				}
			});

			// dojo.query "magic"
			dojo.query("#theNode")
				.connect("onmouseenter",anim,"play")
				.connect("onmouseout",anim,"pause")
				.connect("onclick",function(){
					alert('clicked the button');
				});
		};
		dojo.addOnLoad(init);

	</script>
</head>
<body class="tundra">

	<h1 class="testTitle">dojo._Animation test:</h1>

	<p>
	<div class="dijitInline" id="theNode">Test</div>
	</p>

</body>
</html>