How to use Javascript animation to change the size of a div?
How to use Javascript animation to change the size of a div?
Im trying to use purely Javascript to animate the sizing of a div. Basically I want the div to slide up and down when called to do so. Any help? Thanks.
[url=http://www.7zipdownload.org/]7zip download[/url]
This forum is devoted to Puppy Linux, not Javascript. You can look at Stack Overflow for help on programming, including Javascript.
But to answer your question, you can use jQuery
But to answer your question, you can use jQuery
noryb, this should be an appropriate post, as this is the off-topic area of the forum, so things that are not specific to puppy do belong here. He is asking for programming help in the off-topic programming forum...seems like a perfect fit.This forum is devoted to Puppy Linux, not Javascript. You can look at Stack Overflow for help on programming, including Javascript.
To answer the question, jQuery might work...you can do it at the ajax layer too though...see here for an example:
http://www.java2s.com/Code/JavaScript/Ajax-Layer/AnimationExampleSize.htm
However, this is his first post in this forum. He may have thought that this forum had some relation to Javascript.jyore wrote:noryb, this should be an appropriate post, as this is the off-topic area of the forum, so things that are not specific to puppy do belong here. He is asking for programming help in the off-topic programming forum...seems like a perfect fit.This forum is devoted to Puppy Linux, not Javascript. You can look at Stack Overflow for help on programming, including Javascript.
To answer the question, jQuery might work...you can do it at the ajax layer too though...see here for an example:
http://www.java2s.com/Code/JavaScript/Ajax-Layer/AnimationExampleSize.htm
Re: How to use Javascript animation to change the size of a div?
Hi! Using purely JS ( as in no libraries ) is very painful! You'd have to create a loop using setTimeout or setInterval and increase the width and height that way.madinjeck wrote:Im trying to use purely Javascript to animate the sizing of a div. Basically I want the div to slide up and down when called to do so. Any help? Thanks.
Besides, doing that has little advantages over using jquery on a CDN... since chances are that the user already has it on his cache.
I've created and attached versions of both ( pure js and jquery ). The jquery version was created in 5 minutes and 3 lines of code, while the pure JS version took arround 45 minutes and exactly 50 lines of code.
The jquery one looks and feels better, but wasn't nearly as fun to code
The tar was created using winrar, hope it works for you!
Cheers,
Droope
- Attachments
-
- javascript_joy.tar.gz
- (1.13 KiB) Downloaded 267 times
What seems hard is actually easy, while what looks like impossible is in fact hard.
“Hard things take time to do. Impossible things take a little longer.†–Percy Cerutty
[url=http://droope.wordpress.com/]Mi blog[/url] (Spanish)
“Hard things take time to do. Impossible things take a little longer.†–Percy Cerutty
[url=http://droope.wordpress.com/]Mi blog[/url] (Spanish)