Solved

Javascript animating div resize

Posted on 2015-01-13
3
130 Views
Last Modified: 2015-01-22
Hi Experts

I was trying to resize a div through animation, and I could fairly say that I've made it, however looking at the code, it sounds somehow lame and too many lines. Can we write it in a more professional way, like reducing the code lines ?

A workable example is attached for ease of reference, and here's an explanation of the variables:

objCtrl: a reference to an object to be resized (can be a div or panel)
blnSH: a Boolean variable indicate whether we should handle visibility.
intWS: starting object width
intHS: starting object height
intWE: object width
intHE: object height
dblWN: the new width value
dblHN: the new height value
dblWV: its the width value to be added or subtracted on interval
dblHV: its the height value to be added or subtracted on interval.

Many thanks indeed.
Default.aspx
0
Comment
Question by:Faraj1969
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points
ID: 40549198
Did you try using a transition effect? http://www.w3schools.com/Css/css3_transitions.asp

There's also this page about transitions and animations using javascript: http://css-tricks.com/controlling-css-animations-transitions-javascript/
0
 

Author Comment

by:Faraj1969
ID: 40560748
Hi, I'm requested to make the project compatible with CSS 2, therfore first link doesn't help. I've reviewed the second one when I started writing the script, but it didn't really help either. Thanks.
0
 

Author Closing Comment

by:Faraj1969
ID: 40564359
Thanks for the efforts.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question