Jump to content
TNG Community

Toggling Sections of Code


theKiwi

Recommended Posts

I'm trying to implement a simple "toggle" similar to what is in a number of places in TNG, particularly the Admin area, to show/hide a couple of blocks on the click of a button or link.

I've got it working for the most part as can be seen here

http://genealogy.clanmoffat.org/toggletest.html

but what I'm stumped on trying to figure out is how to change the small + icon to a - icon when the code is expanded.

So can someone cleverer than me please take a look at the code on that page and tell me how I might change it so that the + becomes a - when the bulleted list is opened?

The code of the JavaScript doing this is here

function togglecm( targetId ){
target = document.getElementById( targetId );
if( target.style.display == 'none' ) {
target.style.display = "block";
}
else {
target.style.display = "none";
}
return false;
}

Thanks

Roger

Link to comment
Share on other sites

I'm trying to implement a simple "toggle" similar to what is in a number of places in TNG, particularly the Admin area, to show/hide a couple of blocks on the click of a button or link.

I've got it working for the most part as can be seen here

http://genealogy.clanmoffat.org/toggletest.html

but what I'm stumped on trying to figure out is how to change the small + icon to a - icon when the code is expanded.

So can someone cleverer than me please take a look at the code on that page and tell me how I might change it so that the + becomes a - when the bulleted list is opened?

The code of the JavaScript doing this is here

function togglecm( targetId ){
target = document.getElementById( targetId );
if( target.style.display == 'none' ) {
target.style.display = "block";
}
else {
target.style.display = "none";
}
return false;
}

Thanks

Roger

Roger,

Did you take a look at editconfig.php in the admin folder? The code is there that does the "swap" on the admin page.

I make no claim to understand it.....

Scotty

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...