jQuery & CSS: how to create a feedback slider

Today we are going to create a simple feedback slider using jQuery and CSS. I suppose you've seen many sliders on recently created web sites. They are used to make short forms or generic information slide over a page when a button is pressed. The slider (or tab if you prefer) can be placed where we need it and it can be styled the way we prefer.

We will create an example just to understand the basics behind it. Something like:

A form will slide down when the "feedback" button is pressed.


The jQuery part
Let's start with the jQuery part. We need to link to the library and add a short snippet used to animate the slider when the button is pressed:

Nothing's special here. Remember to add the above in the head of your document.

The CSS
We will give a proper style to every single piece of the slider. We have a container (everything's inside it), the feedback div (where the form is), the button (needed to start the sliding) and the tag (we style it so that all unnecessary decorations will not get in the way). Again, add the following in the head of your document:

The HTML
Finally we create the container and all the rest. Put the following code where you prefer (in the body section of your document):
And that's all. If we want to change the position of the slider, we have to change the container style

Load your page and click on the "Feedback" button.