Solved

Textarea height getting mysteriously set

Posted on 2015-02-12
6
57 Views
Last Modified: 2015-02-18
I have a page that has posts on it and there is a textarea for putting comments in.  The textarea height is somehow getting set by a script I'm using to automatically expand the textarea height.  For some reason the height is getting set for the text area and it is way to big vertically.  

I was hoping someone could help me figure out how to put the height of the textarea to the value i actually define in the css file.  NOTE: using !important isn't an option as this causes the textarea to not expand with the plugin.

Page with big textarea

Plugin for textareas

Thanks for any help!
0
Comment
Question by:Elxn
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:sundaramkumar
ID: 40607595
post your code, that way people can help you.
0
 
LVL 2

Author Comment

by:Elxn
ID: 40608000
The code is all visible on the page.  There are several css files but what throws them off and makes the textarea too big is the plugin.  I took the plugin out and it worked just fine.  But I want to use the plugin.

You can use chrome or firefox to inspect the code, its all right there as you can see in the links i provided in my first post.

Here is the direct link to the plugin code i'm using on my site:  http://girlzunderground.com/new/code/jquery.elastic.source.js
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40608161
This is probably the function in the script where you will need to deal with the height being set by the plugin.  You might have to experiment with the curated height to get what you need:

function setHeightAndOverflow(height, overflow){
				
					var curratedHeight = Math.floor(parseInt(height,10));
					if($textarea.height() !== curratedHeight){
						$textarea.css({'height': curratedHeight + 'px','overflow':overflow});
					}
				}
	

Open in new window

                 

Cd&
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 2

Accepted Solution

by:
Elxn earned 0 total points
ID: 40608316
I wanted to get this done so I looked at it and discovered that the script probably puts in a <div> into the page and I had in my CSS a style that affected all <div> tags inside a section.  So the height was getting set too big because the style applying to the div tag appended to the DOM was being set too big by my CSS code targeting all <div> tags.  

I changed to CSS to not apply to all <div> tags in the section and the problem was solved.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40608328
Great! Glad you got it solved. :^)

Cd&
0
 
LVL 2

Author Closing Comment

by:Elxn
ID: 40616139
I solved my own question, you can put the points to 0 as I don't think I can do this myself.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

809 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