Solved

Javascript animating div resize

Posted on 2015-01-13
3
118 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now