Animation Events

前端之家收集整理的这篇文章主要介绍了Animation Events前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<button id="slideAwayButton">Slide block away</button>
<button id="slideBackButton">Slide block back</button>

<div id="slideTarget" class="red-block slide">
	A red block
</div>
<script>
	dojo.require("dojo.fx");

	dojo.ready(function(){
		var slideAwayButton = dojo.byId("slideAwayButton"),slideBackButton = dojo.byId("slideBackButton"),slideTarget = dojo.byId("slideTarget");

		dojo.connect(slideAwayButton,"onclick",function(evt){
			var anim = dojo.fx.slideTo({
				node: slideTarget,left: "200",top: "200",beforeBegin: function(){
					dojo.style(slideTarget,{
						left: "0px",top: "100px"
					});
				}
			});

			dojo.connect(anim,"onEnd",function(){
				dojo.style(slideTarget,{
					backgroundColor: "blue"
				});
			});

			anim.play();
		});
		dojo.connect(slideBackButton,left: "0",top: "100",{
						left: "200px",top: "200px"
					});
				}
			});

			dojo.connect(anim,{
					backgroundColor: "red"
				});
			});

			anim.play();
		});
	});
</script>

原文链接:https://www.f2er.com/dojo/291693.html

猜你在找的Dojo相关文章