I recently doing a very interesting webpage design with jQuery. The basic idea is very simple. Actually we learned it before for many times. Therefore this is very important to know how to apply what we learned to a real design. This is always true nowadays that: A new invention is simply made up with many simple things.
Let’s discuss what is my jQuery design. The design is that when visitors click on a product image, the product information will slide out from behind the product image.
Actually there are many methods to achieve the animation effect with jQuery. The most simple and easy way is:
- Use an outer Div layer to jail the Product Image Div and Product Info Div.
- Make the size of the outer Div same as the Product Image Div. This way the Product Image and Product Info Divs will overlap together.
- Overlapping the Div layer of Product Image and Product Info. The Product Image Div is on top of Product Info Div.
The other is setting the CSS styles of the Div layers. Then the HTML layout is finished.
As you can see the reason to do that is to force the Product Info Div layer sit below the Product Image Div layer.
Now the idea is very clear. When the width of outer Div layer is animating (increasing) to the right, thus providing enough space for the Product Info Div layer to “spring back” to it’s original position.
Here’s the jQuery codes of how it works:
Note that there is only one <img> tag inside the #frame Div layer:
What if there are more than one <img> tag inside the #frame Div Layer? I will discuss it later.
Download jQuery Source Files:
Click here to download the jQuery source file
Of course, you need to modify the codes a bit to make it more practical.
Leave a Reply