Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
jQuery 1.4 Animation Techniques: Beginners Guide

You're reading from  jQuery 1.4 Animation Techniques: Beginners Guide

Product type Book
Published in Mar 2011
Publisher Packt
ISBN-13 9781849513302
Pages 344 pages
Edition 1st Edition
Languages
Concepts

Table of Contents (19) Chapters

jQuery 1.4 Animation Techniques Beginner's Guide
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introduction 2. Fading Animations 3. Managing Animations 4. Sliding Animations 5. Custom Animations 6. Extended Animations with jQuery UI 7. Full Page Animations 8. Other Popular Animations 9. CSS3 Animations 10. Canvas Animations Pop Quiz Answers Index

Time for action – using the blind effect


I mentioned earlier that the effect is reminiscent of a window blind rolling up or down, so let's base our next example on that:

  1. In the <body> of the template file add the following code:

    <div id="window">
      <div id="blind"><!-- --></div>
    </div>
  2. Implement the effect with the following script:

    $("#window").click(function() {
      $("#blind").toggle("blind");
    });
  3. Save this file as blind.html. The stylesheet for this example is as follows:

    #window {
      width:464px; height:429px; position:relative; cursor:pointer;
      background:url(../img/window.jpg) no-repeat 0 0;
    }
    #blind {
      display:none; width:332px; height:245px; position:absolute;
      left:64px; top:113px;
      background:url(../img/blind.png) no-repeat 0 100%;
    }
  4. Save this as blind.css in the css folder.

  5. When we run the page in a browser, the blind should alternately roll down and up each time the window is clicked:

The previous screenshot shows the blind in its fully-open state...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}