Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-15 12:51:16

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

javascript toggle

I have a list of authors styled by a form.

I want the author, when clicked to toggle open some info about them, not unlike the “advanced options” does in the write tab.

I know I would use something like this:
<code>
<p><a href=”#” onclick=“toggleDisplay(xxxxxxxxx);return false;”>xxxxxxxxxx</a></p>
</code>

The information I want to toggle is in three tags:
one produces unformated text
one produces textiled text which is wrapped in < p > tags
one is an image
(and I may need some styling divs in there)

1. So, what would the javascript (in the head) look like?
2. What goes where the “xxxxxxx”‘s are?

Help please?

Thanks,

Matthew


Offline

#2 2005-11-15 14:09:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: javascript toggle

Hi Matthew, I found how to do that here.

Offline

#3 2005-11-15 14:15:59

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: javascript toggle

Hi Doggiez,
As ever, Thank you. I guess I should have googled longer. I had found a bunch of non-example oriented instructions. I don’t learn very well without seeing – ya know.

Thanks.


Offline

#4 2005-11-16 03:43:27

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: javascript toggle

I have noticed, that the link above gives an example that uses div ID’s and therefore won’t validate on a list where div classes are necessary.

In addition, I can’t figure out how I would go about getting the javascript to work with a dynamically created list?

Any additional thoughts?

Thanks,

Matthew

I would love to replicate this but valid.


Offline

#5 2005-11-16 15:55:05

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: javascript toggle

It looks like the div id is also dynamically created, so that it is not repeated more than once.

You’ll need a coder to help you with this I’m afraid…

Offline

#6 2005-11-16 16:13:19

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: javascript toggle

Doggiez,

Do you know one I could ask?
I mentioned it to Mary, but she’s a busy person.

Matthew


Offline

#7 2005-11-16 17:35:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: javascript toggle

Sorry Matthew, I honestly wouldn’t know :(
Look for plugins that also use javascript and ask the writer? Or just hope that someone visits this thread and recognises a challenge ;)

Offline

#8 2005-11-17 08:25:38

Jeff_K
Archived Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: javascript toggle

Seems like you could do this fairly simply with PHP.. something like a plugin that generated lists with # ids that increased by one each time. then use javascript to hide/show(this) for each <code><li></code>. I have made a plugin that does something similar with multiple article images. Not sure how to access the author list that you are trying to output though…

Last edited by Jeff_K (2005-11-17 08:26:00)

Offline

#9 2005-11-17 10:41:12

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: javascript toggle

matthew, this should work for you, it uses classes to define the toggles:
<a href=“http://www.onlinetools.org/tools/domcollapse/”>domcollapse</a>


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#10 2005-11-17 14:06:57

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: javascript toggle

Kemie,
Great, thank you.
I will check that out.

Matthew


Offline

Board footer

Powered by FluxBB