PDA

View Full Version : Accordion Content anchor/onclick



maxx
06-28-2008, 06:29 PM
1) Script Title: Accordion Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.htm

3) Describe problem: How do i get accordion to anchor to h3 onclick

Hi there,

Very new to java but otherwise know my way around.

I am using accordion content script and generally it works great but i recently noticed due to some large content when a h3 class is expanded and the next h3 class below is clicked and the content disapears off the screen.

Normally i would just put in <a> tag and anchor with h3 both inside h3 but this doesn't seem to work maybe because of the java.

So what i did was changed it to a onclick command which worked great in regards to jump to expanding h3 class into screen view.(like a anchor).

2 problems:-

1) when doing this the onclick function changes the css on h3 title to a hyperlink i'm pretty sure. so need to seperate from css
2) it still has the same problem of when expanded content open the click on below h3 class content disapears of the screen even with onclick.

Is there a change i can make to the js. maybe the onopenclose or toggleclass or togglehtml that will make the clicked h3 anchor no matter wheather anything is open or closed but still perform its normal collapse string.

I hope this isn't to hard to understand.

here is my template page
http://www.singlesdirectory.com.au/templates/template.dwt.php
i have set the first three(3) h3 classes to onclick so you can see what happens when you click the 2nd then the 3rd without closing 2nd.

Looking forward to your help.

maxx
06-29-2008, 04:27 AM
Not to make the problem harder, but depending on the answer i get back if i end up having to use the onclick/anchor function is there a way to control the speed of the function so it scrolls a bit more than a jump.

thanks again for anyone who helps me

ddadmin
06-29-2008, 05:19 AM
I'm not sure I understand your questions actually:


1) when doing this the onclick function changes the css on h3 title to a hyperlink i'm pretty sure. so need to seperate from css

Do you mean when you click on the middle accordion contents on the page, the headers' text changes to underline (looks like a hyperlink)? I'm not seeing that when trying things out.


2) it still has the same problem of when expanded content open the click on below h3 class content disapears of the screen even with onclick.

Hmmm I completely missed what you were trying to say there. :)

Please clarify your question, and perhaps include the exact steps on which header I should click on, and expect to see what.

maxx
06-29-2008, 06:24 AM
Thanks for the reply.

OK lets see if i can make a bit clearer.

the first issue isn't that important. But for some reason when i add "onclick" function to the line that has the h3 title it changes the font size to what you can see in the first three headings but it is meant to look like the last 5 heading based on my css for h3 class. I though the onclick function converted the line over to hyperlink css and that is why font size changes. Yes? NB you can only see font size difference on ie, font looks the same in FF.

But main problem is:-

step by step.

1- open page.
2- click on new south wales
3- click on victoria

when you do this the content disapears of the top of the page.

if you were to close the step 2 before step 3 it works fine.

i still want the auto collapse to work.

but i dont want content to disapear off the page

ddadmin
06-30-2008, 09:17 PM
To your main problem, what content disappears unexpectedly if you click on "south wales" then "victoria" in succession? Using both IE7 and FF3, I don't see any content at the "top of the page" disappearing however you click on these two headers, whether one after the other, or open plus close "south wales" first, then opening "victoria". All I see disappearing is the corresponding sub content for a header as it should.