jQuery 1.4 Animation Techniques - Index of
jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of
The previous screenshot shows how the hover-state is applied to one of the menu items over a short period of time, instead of instantly, as it would normally be with pure CSS, The animation proceeds from top to bottom in the previous picture. Time for action – adding the underlying markup and styling To begin with, we need to create the elements that will be used by the example and the styling to set their visual appearance. [ 23 ] Chapter 2 1. Add the following underlying markup for our navigation menu to the template file we created in Chapter 1, Introduction: Home Articles Code Demos Portfolio 2. Save the page in the jquery-animation directory as fadeIn.html. 3. We'll also need to link to a custom stylesheet for this example. Add the following code to the of the page: 4. Next we should create the stylesheet we just linked to. In a new file, add the following code: body { text-align:center; } nav { display:inline-block; font:normal 18px "Nimbus Sans L", "Helvetica Neue", "Franklin Gothic Medium", Sans-serif; border:2px solid #aaa; -moz-border- radius:7px; -webkit-border-radius:7px; border-radius:7px; } nav ul { list-style-type:none; padding:0; margin:0; } nav li { float:left; border-right:2px solid #aaa; } nav a { display:block; padding:10px 20px; position:relative; color:#333;
Fading Animations text-decoration:none; background-color:#eee; border:1px solid #fff; } nav span { display:none; width:100%; height:33px; padding-top:10px; position:absolute; top:0; left:0; background-color:#ccc; } nav .purecss a:hover { background-color:#ccc; } nav li.first a { -moz-border-radius:7px 0 0 7px; -webkit-border-top-left-radius:7px; -webkit-border-bottom-left-radius:7px; border-radius:7px 0 0 7px; } nav li.first span { -moz-border-radius:7px 0 0 7px; -webkit-border-top-left-radius:7px; -webkit-border-bottom-left-radius:7px; border-radius:7px 0 0 7px; } nav li.last { border-right:none; } nav li.last a { -moz-border-radius:0 7px 7px 0; -webkit-border-top-right-radius:7px; -webkit-border-bottom-right-radius:7px; border-radius:0 7px 7px 0; } nav li.last span { -moz-border-radius:0 7px 7px 0; -webkit-border-top-right-radius:7px; -webkit-border-bottom-right-radius:7px; border-radius:0 7px 7px 0; } 5. Save this file as fadeIn.css in the css folder within our project folder. What just happened? We use the HTML5 element as the logical container for our navigation menu. The menu itself is created from a simple unordered list, where each link is made from an anchor element within a list item. This is the simple, semantic structure that will be rendered by default. Additional enhancements will be made in our script. [ 24 ]
- Page 2 and 3: Download from Wow! eBook jQuery 1.
- Page 4 and 5: Author Dan Wellman Reviewers Shaifu
- Page 6 and 7: About the Author Dan Wellman is an
- Page 8 and 9: Cyril Pierron is an engineer, a web
- Page 12: For Pat Spacagna, the greatest moth
- Page 15 and 16: Download from Wow! eBook Table of
- Page 17 and 18: Table of Contents Time for action -
- Page 19 and 20: Table of Contents jQuery and transf
- Page 21 and 22: Drawing to the canvas 309 Supportin
- Page 23 and 24: Preface What this book covers Chapt
- Page 25 and 26: Preface Have a go hero - heading Th
- Page 27 and 28: Preface Piracy Piracy of copyright
- Page 29 and 30: Introduction In addition to animate
- Page 31 and 32: Introduction When not to use animat
- Page 33 and 34: Introduction of the template file"
- Page 35 and 36: Introduction In the previous screen
- Page 37 and 38: Introduction Once our variables hav
- Page 40 and 41: 2 Fading Animations In this chapter
- Page 42 and 43: [ 21 ] Chapter 2 We can control the
- Page 46 and 47: [ 25 ] Chapter 2 Most of the styles
- Page 48 and 49: 2. What else can be passed into the
- Page 50 and 51: Time for action - creating the dial
- Page 52 and 53: [ 31 ] Chapter 2 For example, the a
- Page 54 and 55: Download from Wow! eBook The follo
- Page 56 and 57: [ 35 ] Chapter 2 The CSS is used mo
- Page 58 and 59: The fadeTo() method is used in the
- Page 60 and 61: [ 39 ] Chapter 2 #messageList table
- Page 62 and 63: [ 41 ] Chapter 2 What just happened
- Page 64 and 65: 2. What format can these arguments
- Page 66 and 67: } var el = $(this); if (el.css("fil
- Page 68 and 69: [ 47 ] Chapter 2 Usually these meth
- Page 70 and 71: Time for action - animations with s
- Page 72 and 73: Download from Wow! eBook [ 51 ] Ch
- Page 74 and 75: 2. Save the changes as toggle.html.
- Page 76 and 77: 3 Managing Animations Like most of
- Page 78 and 79: [ 57 ] Chapter 3 A custom queue tha
- Page 80 and 81: If we wish to see how many function
- Page 82 and 83: 2. What does the queue() method ret
- Page 84 and 85: [ 63 ] Chapter 3 The argument we su
- Page 86 and 87: [ 65 ] Chapter 3 We pass a callback
- Page 88 and 89: [ 67 ] Chapter 3 The first argument
- Page 90 and 91: Delaying queue execution [ 69 ] Cha
- Page 92 and 93: [ 71 ] Chapter 3 Also note that the
The previous screenshot shows how the hover-state is applied to one <strong>of</strong> the menu items<br />
over a short period <strong>of</strong> time, instead <strong>of</strong> instantly, as it would normally be with pure CSS,<br />
The animation proceeds from top to bottom in the previous picture.<br />
Time for action – adding the underlying markup and styling<br />
To begin with, we need to create the elements that will be used by the example and the<br />
styling to set their visual appearance.<br />
[ 23 ]<br />
Chapter 2<br />
1. Add the following underlying markup for our navigation menu to the template file<br />
we created in Chapter 1, Introduction:<br />
<br />
<br />
Home<br />
Articles<br />
Code<br />
Demos<br />
<br />
Portfolio<br />
<br />
<br />
<br />
2. Save the page in the jquery-animation directory as fadeIn.html.<br />
3. We'll also need to link to a custom stylesheet for this example. Add the following<br />
code to the <strong>of</strong> the page:<br />
<br />
4. Next we should create the stylesheet we just linked to. In a new file, add the<br />
following code:<br />
body { text-align:center; }<br />
nav {<br />
display:inline-block;<br />
font:normal 18px "Nimbus Sans L", "Helvetica Neue", "Franklin<br />
Gothic Medium", Sans-serif; border:2px solid #aaa; -moz-border-<br />
radius:7px; -webkit-border-radius:7px; border-radius:7px;<br />
}<br />
nav ul { list-style-type:none; padding:0; margin:0; }<br />
nav li { float:left; border-right:2px solid #aaa; }<br />
nav a {<br />
display:block; padding:10px 20px; position:relative; color:#333;