Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 24 Nov 2014, 10:23
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to use Javascript animation to change the size of a div?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
madinjeck

Joined: 22 Nov 2010
Posts: 1

PostPosted: Mon 22 Nov 2010, 13:23    Post subject:  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.
_________________
7zip download
Back to top
View user's profile Send private message 
noryb009

Joined: 20 Mar 2010
Posts: 540

PostPosted: Mon 22 Nov 2010, 17:28    Post subject:  

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
Back to top
View user's profile Send private message 
jyore


Joined: 06 Nov 2010
Posts: 43

PostPosted: Tue 23 Nov 2010, 14:51    Post subject:  

Quote:

This forum is devoted to Puppy Linux, not Javascript. You can look at Stack Overflow for help on programming, including Javascript.


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.

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
Back to top
View user's profile Send private message 
noryb009

Joined: 20 Mar 2010
Posts: 540

PostPosted: Tue 23 Nov 2010, 17:09    Post subject:  

jyore wrote:
Quote:

This forum is devoted to Puppy Linux, not Javascript. You can look at Stack Overflow for help on programming, including Javascript.


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.

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.
Back to top
View user's profile Send private message 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Wed 24 Nov 2010, 22:05    Post subject: Re: How to use Javascript animation to change the size of a div?  

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.


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.

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 Very Happy

The tar was created using winrar, hope it works for you!

Cheers,
Droope
javascript_joy.tar.gz
Description 
gz

 Download 
Filename  javascript_joy.tar.gz 
Filesize  1.13 KB 
Downloaded  137 Time(s) 

_________________
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

Mi blog (Spanish)
Back to top
View user's profile Send private message 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Thu 23 Dec 2010, 10:32    Post subject:  

Further readings:

http://acuriousanimal.com/blog/2010/12/18/javascript-animations-why-maths-are-important/

_________________
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

Mi blog (Spanish)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0583s ][ Queries: 12 (0.0078s) ][ GZIP on ]