Contact forms are an indispensable part of every website. They are mostly implemented on a separate page and they rarely display creativity, even though there are many ways to improve their visual style. In this tutorial you will see how to create a dynamic, slide-in contact form using jQuery.
Let’s see what we’re trying to achieve with this tutorial. The image below shows the layout of our goal. In the upper right corner of the content is “Contact us” link. When the user clicks on it, the contact form will slide down. When the user submits the form they will get a message that their message has been sent successfully and within two seconds, the entire form will slide up.

Note: You can make this form fully functional by adding validation and some real code that sends the email.
Check out the demo and download full source code here.
The structure
Let’s explain the structure first.
…Company logo
The CSS Code
We have “contactForm” and “contactLink” divs inside the “contactFormContainer” which is positioned absolutely. ContactForm contains form elements, and contactLink will toggle our contact form on click. Simple enough, right? The CSS code will make this clearer:
#contactFormContainer
{
position:absolute;
left:600px;
float:right;
}
#contactForm
{
height:277px;
width:351px;
background-image:url(’bkg.jpg’);
display:none;
}
#contactForm fieldset
{
padding:30px;
border:none;
}
#contactForm label
{
display:block;
color:#ffc400;
}
#contactForm input[type=text]
{
display:block;
border:solid 1px #4d3a24;
width:100%;
margin-bottom:10px;
height:24px;
}
#contactForm textarea
{
display:block;
border:solid 1px #4d3a24;
width:100%;
margin-bottom:10px;
}
#contactForm input[type=submit]
{
background-color:#4d3a24;
border:solid 1px #23150c;
color:#fecd28;
padding:5px;
}
#contactLink
{
height:40px;
width:351px;
background-image:url(’slidein_button.png’);
display:block;
cursor:pointer;
}
#messageSent
{
color:#ff9933;
display:none;
}
Let’s slide folks!
And to make this work, we have to add a touch of jQuery.
$(document).ready(function(){
$(”#contactLink”).click(function(){
if ($(”#contactForm”).is(”:hidden”)){
$(”#contactForm”).slideDown(”slow”);
}
else{
$(”#contactForm”).slideUp(”slow”);
}
});
});
function closeForm(){
$(”#messageSent”).show(”slow”);
setTimeout(’$(”#messageSent”).hide();$(”#contactForm”).slideUp(”slow”)’, 2000);
}
Let me briefly explain the code above. Clicking on #contactLink div will toggle contact form visibility. Once user submits the form, a message “Your message has been sent successfully!” will appear and the entire form will slide up to its original state.
Check out the demo and download full source code here.
Why all of this?
This is just a sample of how you can improve user experience by adding dynamic content to your pages. Besides a contact form, you can create a slide-in login form, search form or anything that you think will improve the user experience.
Is there anything that could be done better? Do you know any other way of doing this? Share some examples!

Comments & Discussion
193 Comments
Pingback: Slide-In jQuery Contact Form | sastgroup.com
Pingback: Slide-in jquery contact form
Pingback: Form contattaci a comparsa | Voci dal web
Pingback: Useful Javascript, jQuery, and AJAX Tutorials and Resources - Massive Link Collection Part #1 | Joren Rapini.com Weblog
Pingback: 120+ Javascript, Ajax, jQuery Mega Toolbox | tripwire magazine
Pingback: jQuery AJAX Validation Contact Form with Modal + Slide-in Transition | The Blog of Joren Rapini
Pingback: 95+ Exceptionally Useful jQuery Plugins, Tutorials and Cheat Sheets « Photoshop.vn – Your Design Resource
Pingback: Adam Bourg » 9 awesome Jquery plugins
Pingback: Think2free.com » 50 must know web developer techniques
Pingback: Think2free.com » 50 must know web development techniques
Pingback: 60+ Must Have jQuery Toolbox | tripwire magazine
Pingback: Slide-in jQuery Contact Form
Pingback: +30 jQuery Eklentisi ~ Metin METE Resmi Web Sitesi — The Metin METE's Official Website
Pingback: +30 jQuery Eklentisi « Bay Bedava – Netten Başlıklar
Pingback: JQuery uygulamaları « Blog Yaşamı
Pingback: JQuery Uygulamaları « Birebir Paylaşım
Pingback: 37 Fenomenales jQuery Plugins y Demos para Desarrolladores | Proyecto Aurora
Pingback: 25 jQuery Tutorials for Creating and Working with Forms « Freelance Web Designer from Hyderabad, India.
Pingback: 25 jQuery Tutorials for Creating and Working with Forms | Son Of Byte - Web Design & Development
Pingback: jQuery Resources for One-Page Portfolios | pro2go Designs Blog
Pingback: Creating a Slide-In jQuery Contact Form | Design Shack | RefreshTheNet
Pingback: 95+ Exceptionally Useful jQuery Plugins, Tutorials and Cheat Sheets | tripwire magazine
Pingback: 50+ jQuery Plugins for Form Enhancements | tripwire magazine
Pingback: 87 great jquery example « Yaniar Prayogo's Blog Of Technology And Programming
Pingback: jQuery Resources for One-Page Portfolios | Vandelay Design Blog
Pingback: 10 Amazing Ajax Css Form Tutorials
Pingback: Creating a Slide-Down jQuery Contact Form | HTMLpl.us
Pingback: 50 jQuery Form Plugins, Tutorials and Resources | webdesign14.com
Pingback: Slideout Panel mit JQuery | i-mill
Pingback: jQuery Resources for One-Page Portfolios | Revolução21
Pingback: 25 jQuery Tutorials for Creating and Working with Forms | Lake of Web
Pingback: Creating a Contact Form with Modal + Slide-in Transition « Tournas Dimitrios
Pingback: Can’t Miss Tutorials for Graphic Designers | Randomness
Pingback: 10 Simple and Effective jQuery Contact Form Styles | InspireMonkey - Neverending Web Curiosity!
Pingback: 10 Simple and Effective jQuery Contact Form Styles | Design Web Development Joomla Magento Wordpress Prestashop blog posts
Pingback: 20+ Simple and Free jQuery HTML Contact Form Plugins | Greepit
Pingback: widget / okienko : sugestia, czego brakuje, itp
Pingback: 30个精心设计的有用的导航菜单教程 | 我们爱网页设计
Pingback: 30个精心设计的有用的导航菜单教程 | 我们爱网页设计
Pingback: 40 Best Free jQuery Login Registration and Contact Forms