Results 1 to 8 of 8

Thread: I need just a few words of javascript code...

  1. #1
    Join Date
    Nov 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need just a few words of javascript code...

    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

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 263 Times in 255 Posts
    Blog Entries
    56

    Default

    Hi Frank:
    Code:
    <a href="javascript: animatedcollapse.hide(['tree'])">hide tree</a>

  3. #3
    Join Date
    Nov 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Question answered

    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
    Last edited by FrankF2; 11-26-2019 at 09:48 AM.

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 263 Times in 255 Posts
    Blog Entries
    56

  5. #5
    Join Date
    Nov 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 263 Times in 255 Posts
    Blog Entries
    56

    Default

    Try
    Code:
    <span class="menuheader" onclick="toggleImage(); $('.tree').fadeOut(0)">Toggle Image</span>

  7. #7
    Join Date
    Nov 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!!

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 263 Times in 255 Posts
    Blog Entries
    56

Similar Threads

  1. Please help with some javascript code
    By HNRTS in forum JavaScript
    Replies: 2
    Last Post: 01-02-2013, 11:59 PM
  2. Replies: 0
    Last Post: 12-09-2012, 05:39 PM
  3. Javascript code that needs a little help
    By reddiestorm in forum JavaScript
    Replies: 2
    Last Post: 02-08-2009, 06:03 PM
  4. Replies: 2
    Last Post: 10-27-2008, 05:16 AM
  5. Possible to combine lists of words in Javascript?
    By someprogress in forum JavaScript
    Replies: 6
    Last Post: 12-19-2006, 08:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •