PDA

View Full Version : ddaccordian - need clickgo on hide/collapse



sandbag
02-25-2010, 04:50 PM
1) Script Title: ddacordian

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

3) Describe problem:

Is it possible to get the clickgo behaviour also when the H3>UL group is collapsed (it only seems to happen when expanding)? I see this around line 126

if (config.revealtype=="clickgo"){
config.postreveal="gotourl" //remember added action
config.revealtype="click" //overwrite revealtype to "click" keyword
}

but my hamfisted attempts at javascript just make it break...

ddadmin
02-25-2010, 09:44 PM
Try the below modified .js file, which should do it.

sandbag
02-26-2010, 11:35 AM
ddadmin - I am truly impressed with your speed of response. However, take a look at:

http://www.kwiksite.santdemo.co.uk

If you expand "Products" and then click on "Our Services" and back again, you will see it's picking up the wrong target.href somewhere in the code...

Look, I truly appreciate your effort, and if you can work this out, I'm happy to paypal you a few quid!

Cheers for any help

Steve

please PM me if you need to communicate directly.

sandbag
02-26-2010, 11:56 AM
WOOT!!!! I think I might have fixed it...

Line 185


ddaccordion.collapseit(lastexpanded.$header, lastexpanded.$content, config, true, false) //next to Last Boolean value sets 'isuseractivated' parameter


If I read it correct, then the above only happens to close previously expanded headers - so it stands to reason they haven't been "clicked" (as the user just clicked something else!)

and then around line 90


if (targetLink && directclick) //if this header is a link

That's it... it works now as I hoped.. just need to check it in the other browsers... Your comments would be most appreciated, as I am in no way totally confident in my code hacking!

ddadmin
02-27-2010, 09:27 AM
If it works it works :) Let me know if you find any problems in other browsers. The two browsers I tested the modified code in were IE8 and FF3.6 btw.