Connect animation : connect « Dojo toolkit « JavaScript Tutorial






<html>
<head>
<title>Dojo example</title>
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
    dojo.addOnLoad(function(){
        dojo.query("#showMe").onclick(function(e){
            var node = e.target;

            var a = dojo.anim(node, {
                backgroundColor: "#ff0",
                color: "#00f"
            }, 1000);

            dojo.connect(a, "onEnd", function(){
                dojo.anim(node, { color: "#0ff" }, null, null, function(){
                    node.innerHTML = "Alert!";
                    dojo.anim(node, { color: "red" });
                });
            });
        });
    });
</script>
<body>
<div id="showMe">
    click me
</div>
</body>
</html>








29.7.connect
29.7.1.Connect animation
29.7.2.Connect two animations
29.7.3.Connect two functions together
29.7.4.Add event to a button with dojo.connect
29.7.5.Add event to a tag with dojo.connect