Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 17:19

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Js Keyeingabe + Animate Problem

Discussion on Js Keyeingabe + Animate Problem within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
Cc_Cc_Cc's Avatar
 
elite*gold: 200
Join Date: Mar 2011
Posts: 352
Received Thanks: 9
Js Keyeingabe + Animate Problem

Guten Tag,

ich habe eine Textarea und wenn man mehr als 5 Zeichen eingibt soll die Höhe um 100px steigen. Klappt auch , aber wenn ich jetzt mal sehr sehr schnell etwas eingebe macht er die höhe 2x oder 3x plus 100px. Also er führt dann den Animate Befehl 2-3x aus, dann ist meine Area Box nicht um 100px gestiegen sondern um 200-300px. Woran liegt das?

PHP Code:
            $('.comment-area-text').on('keyup', function(e) {
            
                var 
data = $(this).val();
                
                if(
data.length 5) {
                    
                    if($(
'.comment-area-text').height() === 19) {
                    
                        $(
'.comment-area-text').animate({
                            
"height":"+=100px"
                        
}, 500);
                
                        
                    }
                    
                }
}); 
Cc_Cc_Cc is offline  
Old 01/27/2020, 05:40   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Quote:
Originally Posted by Cc_Cc_Cc View Post
Guten Tag,

ich habe eine Textarea und wenn man mehr als 5 Zeichen eingibt soll die Höhe um 100px steigen. Klappt auch , aber wenn ich jetzt mal sehr sehr schnell etwas eingebe macht er die höhe 2x oder 3x plus 100px. Also er führt dann den Animate Befehl 2-3x aus, dann ist meine Area Box nicht um 100px gestiegen sondern um 200-300px. Woran liegt das?

PHP Code:
            $('.comment-area-text').on('keyup', function(e) {
            
                var 
data = $(this).val();
                
                if(
data.length 5) {
                    
                    if($(
'.comment-area-text').height() === 19) {
                    
                        $(
'.comment-area-text').animate({
                            
"height":"+=100px"
                        
}, 500);
                
                        
                    }
                    
                }
}); 
That weird behaviour is because your animation is called multiple times before finishing.

You can solve this problem using .stop(clearQueue,goToEnd), use the params it works best for you


If you want a dynamic box, then u need to create a function that calculates the size of the box
elmarcia is offline  
Thanks
1 User
Old 01/27/2020, 16:27   #3
 
Cc_Cc_Cc's Avatar
 
elite*gold: 200
Join Date: Mar 2011
Posts: 352
Received Thanks: 9
Thank you its works !
Cc_Cc_Cc is offline  
Reply


Similar Threads Similar Threads
jquery DIV animate von der Mitte aus
08/14/2012 - Web Development - 7 Replies
so jetzt brauch ich mal eure hilfe :) Titel sagt eig. schon alles ich möchte ein div von der mitte aus breiter und höher stellen, sowas wie ein zoomeffect, wie stell ich das an hier könnt ihr euch es ansehen
[SELL]Animate Userbar e*gold
07/23/2012 - elite*gold Trading - 7 Replies
Examples : Roronoa Zoro : http://g1207.hizliresim.com/z/f/9pvjf.gif Nico Robin : http://g1207.hizliresim.com/z/f/9pvkj.gif Price : 10 e*gold How to Get : Send via PM ; picture, text and color or what you want extra.
[jQuery] Animate()-Problem
06/19/2012 - Web Development - 4 Replies
Hallo, Leute! Ja, sogar ich brauche Hilfe. :D Und zwar wollte ich einen Container auf Knofdrück aus-/einfahren lassen. Sprich, etwas in der Art: $('#chatbox').animate({'height':'+=50'}, 400); Die Höhe verringern klappt problemlos, vergrößern nicht. Bei obigem Beispiel wird die Höhe zunächst verkleinert und erst dann vergrößert. Das sieht ein wenig so aus, als würde der untere Rand "hüpfen". Allerdings ist dies nicht mehr der Fall, wenn ich die Style-Angaben padding & border für das...
[Animating Service]Animate your banner/logo/whatever ^^"
07/01/2010 - elite*gold Trading - 3 Replies
Hello e*pvpers! Today I want to start an animating service. *+ What is that? If your banner is ready,but it looks silly without animation,you can order animation here. For now I'll be adding only 2 types of animation which preview is located below. Later there will be more.



All times are GMT +2. The time now is 17:19.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.