Advertisement

10.10.2008 at 02:18PM PDT, ID: 23805533 | Points: 500
[x]
Attachment Details

Change Max-Height Property On A Div .Class Upon Click

Asked by thyros in JavaScript, Hypertext Markup Language (HTML), Extensible HTML (XHTML)

How to remove the max-height setting from a single div element via class attribute upon click?

I have several rows of text, each row is enclosed within a div.  For example;


<div class="promotext">Blah Blah Blah</div>

<div class="promotext">Blah Blah Blah</div>

<div class="promotext">Blah Blah Blah</div>


In the css stylesheet I have the setting

.promotext {max-height:3.7em; overflow:hidden;}

This ensures that if 'Blah blah blah' gets too long, after 3 lines, the text overflow is hidden.  However, I want to enable the functionality that if a user clicks on the 'Blah blah' text, the max-height property is removed or nullified so that the full text becomes visible - however, only the div that was clicked should expand.

So setting a new style on .promotext wont cut it because all the text rows will expand, because we only want the clicked upon div to expand.  The text rows are generated dynamically, sometimes there is 1-3 rows, sometimes there is upto 50 text rows.  I cannot assign a unique ID to each text row as it is a template which repeats itself.

Any help in creating an expanding div solution would be much appreciated.  Thanks.Start Free Trial
[+][-]10.10.2008 at 04:42PM PDT, ID: 22691645

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 04:43PM PDT, ID: 22691655

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.11.2008 at 05:14AM PDT, ID: 22693652

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.11.2008 at 06:30AM PDT, ID: 22693851

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628