View Single Post
Old 08-29-2008, 06:41 AM   #1 (permalink)
chicgeek
Empress™
 
chicgeek's Avatar
 
Join Date: 08-19-04
Location: Canadian in the UK
Posts: 14,213
iTrader: 0 / 0%
chicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest order
Peekaboo Content: href="#" targetting top of page

Bonjour!

I'm using a simple JavaScript peekaboo code to allow hiding of content until requested. I've used to code before but this time am encountering a bit of a problem: when the trigger link is clicked, the top of the page is targetted. Each of these links is given href="#". In addition, the section will only expand after the trigger link is clicked once more. The site is based off of a university template, so I have a feeling the issue might be a conflict with other code surrounding the content, but I can't figure it out.

In head:
Code:
<script type="text/javascript"> function toggleview(element1) { element1 = document.getElementById(element1); if (element1.style.display == 'block' || element1.style.display == '') element1.style.display = 'none'; else element1.style.display = 'block'; return; } </script>
In stylesheet:
Code:
.extra { display: none; }
Content code:
Code:
<a href="#" onclick="toggleview('q1')">[show]</a> <p id="q1" class="extra"> Hide Me </p>
Example pages:
http://music.york.ac.uk/new/prospect...aduate/faq.php
http://music.york.ac.uk/new/staff/pr...wainwright.php
Any and all help is greatly appreciated!
__________________
laura / chicgeek
soprano & web designer
@chicgeek on Twitter
laurakishimoto.ca
chicgeek is offline   Reply With Quote