We love Web 2.0

Your own voice on the web

Everyone can write & share

                                                   Blog
Explore My Blog Explore My Blog





Social Media & Social Media Marketing
 





 Social Networking





Web Development, SEO & Online Marketing
 

   
  Bookmark and Share
  
jQuery Animate Image Filling Up
      
Sep
08
Jamal Ahmad

jam05pgs

1 Comments  |   4049 Hits
Tags:   jquery animate image filling
 

The Photoshop Portion – Preparing Your Image(s)

Step one requires that you use your decision making skills to figure out what image you want to use. For this example, I have selected a character which I found in this wonderful Vectortuts+ tutorial.

Next we're going to want to drop it in to Photoshop for some basic preparation. We're are going to end up with three images, in order to understand what role each will play, please check out the helpful diagram below.

jQuery Animate Image Filling Up

If any of the following confuses you in any way, take a look at the images I have included in the downloadable files, it should be easier to understand once you see the final products.

What we're looking to get first is a base image (in this case the actual character), which is a simple matter of saving a cropped image to the size you want. If you would like to include a border around your image, as I have in the demo, make sure the background color matches the one you plan to make the border.

We will skip the middle layer for a moment and look at the top image, which will act as a frame. This image is the inverse of the base image, made so only a cutout of the character can peek through.
In Photoshop you will want to CMD (CTRL on Windows) + Click the base image to select it and then hit CMD (CTRL on Windows) + Shift + I to select the inverse. The selected area will be the frame image, which you can color however you would like.

If you want to include a 10px border around your image, similar to the one in the demo add the following step: While your base image is selected hit Select > Modify > Expand and put in your desired border size, then go ahead and select the inverse. You might need to increase your canvas size in order to prevent unwanted cropping.

Finally we need to make the middle layer image, which I have drawn a box around in the layer diagram. This is the image that will slide up/down above the image and create a unique fill effect (aka paint dripping). I will let you be creative here, but I have included two in the attached files for inspiration.

The CSS

You will notice that I've tagged on helpful comments with each relevant element, read them to understand what you are writing.

1.*{  
2.margin:0;  
3.padding:0;  
4.}  
5.body {  
6.text-align: center;  
7.background: #A4CAEF;  
8.text-align: center;  
9.padding: 20px;  
10.}  
11./*Container for the image frame aka the top image*/ 
12..frame{  
13.position: absolute;  
14.z-index: 2;  
15.}  
16./*The container the character goes in for easy placement*/ 
17.#dude{  
18.height: 575px;  
19.width: 300px;  
20.margin: 0px auto;  
21.}  
22./*Adds padding around image to make border. Needed only for pngs.*/ 
23.img.loadpic{  
24.margin: 10px;  
25.}  
26./*Prevents spillover from middle layer moving up*/ 
27.#dudecontainer{  
28.position: relative;  
29.overflow: hidden;  
30.height: 575px;  
31.width: 300px;  
32.background: #FFF;  
33.}  
34./*The middle layer container, hiding base image initially*/ 
35.#dudeoverlay{  
36.position: absolute;  
37.z-index: 1;  
38.}  
39./*White div in #dudeoverlay that fill space the edge image doesn't*/ 
40.#dudeblock{  
41.height: 625px;  
42.width: 300px;  
43.background: #FFF;  
44.}  
45./*Image that adds effect the fill, in this case slanted*/ 
46.#dudeedge{  
47.height: 90px;  
48.width: 300px;  
49.background: url('slash.png');  
50.}

The HTML

This part is straightforward HTML, just take notice of the hierarchy when putting it all together.

1.<div id="dude"> 
2. <div id="dudecontainer"> 
3.    <div class="frame"> 
4.      <img src="dudeframe.png"/> 
5.    </div> 
6.    <div id="dudeoverlay"> 
7.       <div id="dudeblock">&nbsp;</div> 
8.       <div id="dudeedge">&nbsp;</div> 
9.    </div> 
10.    <img src="dude.jpg"/> 
11. </div> 
12.</div>

The jQuery

This is by far the easiest cut and paste job ever. Are you ready?

1.$(document).ready(function() {  
2. $("#dudeoverlay").stop().animate({top:'-665px'},{queue:false,duration:3500} );  
3.});

Boom, it's that easy. Depending on the size of your image you will want to play around with the top attribute, you will want it to be large enough to completely slide the overlay layer off of the base image. Negative numbers make it go up, positive make it go down. Feel free to fool around with the duration too.

View live demo 1

View live demo 2

Download source code

[ Stumble Upon ] [ Facebook ] [ del.icio.us ] [ furl ] [Sphinn] [ Digg ] [ Twitter ] [ Technorati ] [ Reddit ] [ Subscribe To RSS Feeds ]

1

 
 
 
web designing company

Thursday, September 17, 2009 @ 12:58 AM

 

Jquery is a very usefull language and the way which it fills the image is awesome !so, its a nice post and you done a great job over here!

 
   
 
Leave your comments
 
  Your comments  

     
name  

     
  email  

     
website    

     
5 + 3 =    

     
   
     

 

 

Follow me on twitter

Follow me on facebook

 

 
   

Lunarpages.com Web Hosting

   

affiliate_link

   

affiliate_link

   

Buy Now - PayPal

   
 
   
  Blog Community
 
 
tissa
darrenrowse
amour
niculae
sassyqarla
summerzeet
electrostar
good-pens
kh
travelhotelworld
tunyalitk
masterartrep
dain22
bloggersun
jameslove4enao
thebeespace
majalahpatani
caryngf
wonkapromotions
jam05pgs
 
  View more bloggers   Join Community
   
   
  Popular Posts
 
 
JQuery Beautiful Image Slide Show in New Way
Good Pens, Saturday 18th April 2009

How 24 Hours of Work Will Send Millions of Readers to My Blog
Darren Rowse, Thursday 4th December 2008

Ajax Animated Live Search
Tunya Litk, Monday 4th May 2009

Can you REALLY Make Money Blogging?
Darren Rowse, Wednesday 3rd December 2008

Ajax instant edit
Jamal Ahmad, Friday 15th May 2009
   
   
  ExploreMyBlog Poll
 
 

Is Bing a better search engine than Google?

 

Yes

No
Unsure
 

 
   
  Blog Categories
 
 
About Blogging
Affiliate Marketing
AJAX
Banners
Blog Directories
Blog Marketing
Browsing
Copy Writing
CSS
E-Commerce
Email Marketing
Forms
Google AdSense AdWords
JQuery
Marketing Tools and Tips
Online Advertising
Online Marketing
Online Newsletter
Pay Per Click Strategy
RSS Feed Strategy
Search Engine Optimization
Social Media
Social Networking
Web 2.0
Website Analysis and Stats
Website Designing
Website Traffic
   
   
   

 

 

 

 

© Copyright Explore My Blog 2009, all rights reserved
A company registered in north America, Europe, Asia and Middle East as Explore Group.