jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of jQuery 1.4 Animation Techniques - Index of

02.06.2013 Views

Time for action – creating a slide-down login form [ 75 ] Chapter 4 In this example we'll see how easy it is to implement a login form that slides open when a link is clicked. It's common practice to include a login link at the top of a page, but usually the whole login form isn't shown. Instead, clicking the link will reveal an inline form that is hidden by default. The following screenshot shows how the page will appear with the login form open: 1. To begin with, add the following code to the of our template file: Already registered? Login Login Form Username: Password: Remember me: Login

Sliding Animations 2. Save the file as slideDown.html in the main project folder. 3. Next let's add the CSS for this example. In a new file in your text editor, add the following code: header { display:block; font-family:Verdana, Arial, Helvetica, sans-serif; } header ul { margin:0; position:relative; float:right; list-style-type:none; font-size:11px; } header ul li { float:left; margin-top:10px; } header ul li a { display:block; margin:-13px 0 0 10px; padding:11px 18px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; font-size:14px; color:#000; } header ul li a:hover, header ul li a:focus, header ul li a.on { padding:3px 10px; border:8px solid #666; background-color:#fff; text-decoration:none; } header ul li a.on { border-bottom:0; padding-bottom:10px; -moz-border-radius-bottomright:0; -moz-border-radius- bottomleft:0; -webkit-border-bottom-right-radius:0; -webkit-border-bottom-left-radius:0; border-bottom-right- radius:0; border-bottom-right-radius:0; position:relative; z-index:10; outline:0; } header form { display:none; width:260px; border:8px solid #666; -moz-border-radius:px; -moz-border-radius-topright:0; -webkit-border-radius:5px; -webkit-border-top-right-radius:0; border-radius:5px; border-top-right-radius:0; position:absolute; right:0; top:27px; z-index:5; } header fieldset { margin:0; padding:20px 10px 10px; border:0; } header legend { display:none; } header form label { display:block; float:right; font-size:14px; } header form label:first-child { margin-bottom:10px; } [ 76 ]

Sliding <strong>Animation</strong>s<br />

2. Save the file as slideDown.html in the main project folder.<br />

3. Next let's add the CSS for this example. In a new file in your text editor, add the<br />

following code:<br />

header {<br />

display:block;<br />

font-family:Verdana, Arial, Helvetica, sans-serif;<br />

}<br />

header ul {<br />

margin:0; position:relative; float:right; list-style-type:none;<br />

font-size:11px;<br />

}<br />

header ul li { float:left; margin-top:10px; }<br />

header ul li a {<br />

display:block; margin:-13px 0 0 10px; padding:11px 18px;<br />

-moz-border-radius:5px; -webkit-border-radius:5px;<br />

border-radius:5px; font-size:14px; color:#000;<br />

}<br />

header ul li a:hover, header ul li a:focus, header ul li a.on {<br />

padding:3px 10px; border:8px solid #666; background-color:#fff;<br />

text-decoration:none;<br />

}<br />

header ul li a.on {<br />

border-bottom:0; padding-bottom:10px;<br />

-moz-border-radius-bottomright:0; -moz-border-radius-<br />

bottomleft:0;<br />

-webkit-border-bottom-right-radius:0;<br />

-webkit-border-bottom-left-radius:0; border-bottom-right-<br />

radius:0;<br />

border-bottom-right-radius:0; position:relative; z-index:10;<br />

outline:0;<br />

}<br />

header form {<br />

display:none; width:260px; border:8px solid #666;<br />

-moz-border-radius:px; -moz-border-radius-topright:0;<br />

-webkit-border-radius:5px; -webkit-border-top-right-radius:0;<br />

border-radius:5px; border-top-right-radius:0;<br />

position:absolute; right:0; top:27px; z-index:5;<br />

}<br />

header fieldset { margin:0; padding:20px 10px 10px; border:0; }<br />

header legend { display:none; }<br />

header form label { display:block; float:right; font-size:14px; }<br />

header form label:first-child { margin-bottom:10px; }<br />

[ 76 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!