0

Hey all i have a JSFiddle that i have been working on with trying to get it to animate going from bottom to top instead of what its currently doing, top to bottom.

This will be used as a animated bar graph for a fund raiser amount that's in front of an image and this bar graph will represent the amount in dollars they have raised so far.

The jsfiddle is here: http://jsfiddle.net/kboucher/YDruG/

Any help would be great!!!

update

The HTML code:

<a href="#" id="button">View 100 (out of 500)</a>

<div id="barGraph-container">
    <div id='barGraph'></div>
</div>​

The JS:

$('#button').click(function(){
    $('#barGraph').animate({height:'72px'}, 500);
});

​ The CSS:

#barGraph-container {
    height: 200px;
    position: relative;
}
#barGraph {
    height: 200px;
    width: 50px;
    background-color: #000;
    position: absolute;
    bottom: 0;
}​
StealthRT
  • 10,108
  • 40
  • 183
  • 342

3 Answers3

1

Try putting a container around your bar graph and use absolute positioning to anchor it to the bottom of the container.

Like this: http://jsfiddle.net/kboucher/YDruG/

Kevin Boucher
  • 16,426
  • 3
  • 48
  • 55
0

By giving the graph bar a relative position, and adding a top position animation to compensate for the reduced height, you can achieve this quite easily.

http://jsfiddle.net/GZeu3/19/

Nw167
  • 169
  • 5
0

Here is an example that uses 2 divs to "reveal" the graph which looks like it is growing.

http://jsfiddle.net/GZeu3/23/

lerxstrulz
  • 143
  • 1
  • 8