View Full Version : I need just a few words of javascript code...
FrankF2
11-24-2019, 10:12 AM
1) Script Title: Animated Collapsible DIV v2.4
2) Script URL (on DD): at least seven years old, has apparently been phased out
3) Describe problem: please supply the line of javascript which will collapse all expanded menu groups with the class "tree".
Many thanks in advance!
Frank
molendijk
11-25-2019, 12:03 PM
Hi Frank:
<a href="javascript: animatedcollapse.hide(['tree'])">hide tree</a>
FrankF2
11-26-2019, 09:37 AM
sorry, it didn't work.
I am getting this error with the F12 key:
Uncaught TypeError: Cannot read property '$divref' of undefined
at Object.showhide (andiv.js:44)
line 44 is: var $divref=this.divholders[divid].$divref //reference collapsible DIV
molendijk
11-26-2019, 10:35 AM
That's odd. Can you show me your problematic page?
FrankF2
11-26-2019, 08:32 PM
I have posted a demo version of my page here: http://dewenka.net/menu.cfm
What I want to happen is that whenever the text "Toggle Image" is clicked, any menu tree which is unfolded should be closed.
Line 87 is your suggested javascript command. It is currently commented out because of the error messages.
If line 87 would close any open trees, my problem would be solved.
molendijk
11-27-2019, 12:26 PM
Try
<span class="menuheader" onclick="toggleImage(); $('.tree').fadeOut(0)">Toggle Image</span>
FrankF2
11-27-2019, 02:55 PM
That was almost what I need.
If you click first on "animals" and then on "plants", the menu slides up as the original code was meant to do.
But if you click on 'animals' and then on 'Toggle Image', the menu snaps shut (no slide).
I changed your fadeOut(0)' to 'slideUp(600)' and now it works just the way I imagined. (click 'Toggle Menu2' on the demo page).
Thanks for putting me on the right track!!
molendijk
11-27-2019, 03:46 PM
I'm glad it works now.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.