expanding contact form

How we can create an expanding contact form which expands from an icon or button to form? Solution: See this Expanding Contact Form With Email Validation, Icon To Form Expands.

Previously I have shared some contact forms, but this is a unique one because it is an expanding form. Basically, we use a contact form on our website because the user can easily contact about any query or complaint. And every website uses a separate page for contact information and forms. But if we use this kind of expanding form, then we can place it on every page on the website.

Today you learn to create an icon to form expands program. Basically, there is an SMS/Email icon at the bottom of the page. When you will click on it it will expand and become a contact form. There are some input fields for name, email, and select option, etc on the form, also some titles and icons like contact icon and close icon. You can close the form by click outside of form and press the close icon. There is an email validation function and success message panel.

So, Today I am sharing Expanding Contact Form With Email Validation. There I have used HTML to create the layout, CSS for styling, and jQuery for functioning. When form expands then an overlay effect comes on the page, like that the program has many little animations and effects. This is a very interesting concept, if you use this form on your website then you can put it on every page because it doesn’t take much space.

If you are thinking now how this expanding overlay contact form actually is, then see the preview given below.

Preview Of Icon To Form Expands

See this video preview to getting an idea of how this form animation looks like.

Live Demo

Now you can see this program visually, also you can see it live by pressing the button above. If you like this, then get the source code of its.

You May Also Like:

Expanding Contact Form Source Code

Before sharing source code, let’s talk about it. First I have created the main div with class name ‘form-overlay‘ and placed all the contents inside it. There I have used the font-awesome library to placing the envelope and close icons. After that, I have placed divs and other tags for text and inputs for creating the form’s fields. Also in the HTML file, I have linked other files like CSS, JS, and jQuery CDN.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. With CSS, first I gave basic values like size, position, margin, padding, etc to all the elements. There I have used CSS transition command for animation and cubic-bezier command to define the animation curve. I also used CSS @keyframe command to create the animation effects.

jQuery handling here forms open/close, validation, and error/success features in this program. I used .toggleClass command to open and close toggle function in the form. There I have defined an email pattern for validation and visualize messages after checking using if{} else{} statements. Left all other things you will understand after getting the codes, I can’t explain all in writing.

For creating the program you have to create 3 files. First file for HTML, second for CSS, and the third file for JavaScript. Follow the steps to creating this program without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created Expanding Contact Form With Email Validation, Icon To Form Expands. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

8 COMMENTS

  1. Can you explain, in this plan, where the recipient’s email is located, everything I read about html, java, php, for a while I do not have time to practice, forgets the process, thank you shaan

LEAVE A REPLY

Please enter your comment!
Please enter your name here