Ok... I know this can be done, but I don't know how to do it.
I want to have a piece of text... say, the first line of a paragraph. When this line is clicked, the rest of the paragraph magically appears.
Also, if reasonable, is there an easy way to close [u]all[/u] the paragraphs previously opened this way?
I'm using frames on my site, and I want to try and maximise the use of space.
If someone could post up the script required to achieve this, and its implimentation, it would be a great help.
____________________________
Forever trust in who we are,
And nothing else matters.
-Metallica-
____________________________
Comments
.content{visibility: hidden}
function show()
{
content.style.visibility="visible"
}
function hide()
{
content.style.visibility="hidden"
}
The first line of the paragraph. Then rest of the content of the paragraph. This stuff will be hidden until the first line is clicked on. You can put a button containing a close function when depressed that makes the paragraph hidden again.
for netscape browsers youd have to make some small changes with respect to visibility. i believe it uses show/hide. and as far as closing the content, you can insert the hide() function anywhere you like. good luck, suchaputz.
It does the job, though not entirely as I would like...
Ideally, I click on the text, and the rest of the paragraph
shows. Then I click on the text again, and it disappears.
The button you used will come in handy for closing all the
paragraphs. Thanks for your help. I'll try playin around
with the scripts you posted, but if I don't post up the
solution before you read this, could you try the above
please?
Thanks for your help.
Tony.
____________________________
Forever trust in who we are,
And nothing else matters.
-Metallica-
____________________________
but what I expected to happen, didn't happen;
What I expected to happen:
Since it's a style that's applied to each tag that uses it,
if I click on the text, wouldn't all paragraphs expand???
What did happen:
I got an error!! 'content.style' is not an object.
Can n e one help???
Tony
____________________________
Forever trust in who we are,
And nothing else matters.
-Metallica-
____________________________
.content{visibility: hidden}
var isVisible=false
function show()
{
if(isVisible == false)
{
content.style.visibility="visible";
isVisible = true;
}
else if(isVisible == true)
{
content.style.visibility="hidden";
isVisible = false;
}
}
The first line of the paragraph. Then rest of the content of the paragraph. This stuff will be hidden until the first line is clicked on. Then hidden when clicked again. One function both shows and hides the text.
But it's at home and I'm in college atm.
I'll post it up tomorrow if I remember to bring it in.
____________________________
Forever trust in who we are,
And nothing else matters.
-Metallica-
____________________________
[code]
Expanding Paragraphs
function toggle(element){
var e = eval("document.all." + element);
if( e.style.display == 'none' ) e.style.display = '';
else e.style.display = 'none';
}
Lalalala
Paragraphs
Paragraph 1
Here's some of the paragraph
Paragraph 2
Here's another one...
Paragraph 3
How long will I go on?
Paragraph 4
I give up... last one.
[/code]
____________________________
Forever trust in who we are,
And nothing else matters.
-Metallica-
____________________________