jquery – starter tutorial #3

If you haven’t checked the previous posts, please check the following
jquery – starter tutorial #2
jquery – starter tutorial #1

This post will give you more on the animation and design functions of jquery.

<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
      $("#hide").click(function(){
        $(".hide").hide();
        $(".show").hide();
      });
    });

    $(document).ready(function(){
      $("#show").click(function(){
        $(".hide").show("slow");
        $(".show").show("fast");
      });
    });

    $(document).ready(function(){
      $("#toggle").click(function(){
        $(".toggle").slideToggle();
      });
    });

    $(document).ready(function(){
      $("#animate").click(function(){
        $("div").animate({height:300},"slow");
    $("div").animate({width:300},"slow");
    $("div").animate({height:100},"slow");
    $("div").animate({width:100},"slow");
      });
    });

    $(document).ready(function(){
      $("#fadeTo").click(function(){
        $(".fadeTo").fadeTo("slow",0.25);
      });
    });

</script>

</head>
<body>
<button id="hide">hide</button>
<button id="show">show</button>
<button id="toggle">toggle</button>
<button id="fadeTo">fadeTo</button>
<button id="animate">animate</button>

<div>show me</div>
<div>hide me</div>
<div>toggle me</div>
<div style="background:yellow;">fadeTo me</div>
<div style="background:#98bf21;height:100px;width:100px;position:relative">animate me</div>

</body>
</html>

Click the buttons to see the methods in action.

Advertisements

One thought on “jquery – starter tutorial #3

  1. Pingback: JavaShine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s