Results 1 to 1 of 1

Thread: Neeed help on accordian script

  1. #1
    Join Date
    Oct 2008
    Location
    Iowa
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Neeed help on accordian script

    1) Script Title: ddaccordion.js

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

    3) Describe problem:

    Please follow the following link : http://www.corecurriculum.iowa.gov/
    First of all I would like to thank all those who are involved in designing/Implementing this remarkable menu...

    The menu works great as long as you click on the menu items it expands
    and displays its content list items ... great!!! .. and i absolutely love it ... I admire the way it works but i have been having one problem with it

    problem:


    try navigating to the following link: (without hitting the home page or the discipline page)


    http://www.corecurriculum.iowa.gov/D...Geometry+(9-12)


    it simply redirects to the previous header ... not that it would be a problem now but i am developing a search functionality for the site now and it is required that the links on the search page have to point to the actual page and i think i might be running in to some trouble :


    here is the core i am using ddaccordion.js

    here is the link: http://www.corecurriculum.iowa.gov/S...ddaccordion.js

    and here is the MenuInit.js function:



    function initMenuControl()
    {



    ddaccordion.init({headerclass: "submenuheader", contentclass:"submenu" ,revealtype: "click",collapseprev: true, defaultexpanded: [], onemustopen: false, animatedefault: false, persiststate: true, toggleclass: ["", ""], togglehtml: ["suffix", "", ""], animatespeed: "normal",
    oninit:function(headers, expandedindices)

    { var url = window.location.toString();
    var menuitemstags= document .getElementsByName ("menuitem")
    var submenuItemTags=document .getElementsByName ("Submenuitem")
    var divs = document .getElementById("glossymenu");
    var atagcompletemenu= divs.getElementsByTagName("a");



    for (i=0 ; i<menuitemstags.length;i++) // Iterating thorough all the menu items (discipline level/category level) and setting the selected background color
    {if (url == menuitemstags[i])
    {
    menuitemstags[i].style.backgroundColor='#005500';
    menuitemstags[i] .style.color='white';

    }
    }

    for (i=0 ; i<submenuItemTags.length;i++)
    {
    if (url == submenuItemTags[i]) // Iterating thorough all the menu items (Sub-discipline level/Sub-category level) and setting the selected background color
    {
    submenuItemTags[i].style.backgroundColor='#FFFF99';
    submenuItemTags[i] .style.color='#005500';
    }
    }


    for (var i=0; i<expandedindices.length; i++)
    {
    var expandedindex=expandedindices[i] //index of current expanded header
    if (url == atagcompletemenu[0] )
    {
    ddaccordion.collapseall('submenuheader')

    }

    }




    if (url ==atagcompletemenu [1]|| url ==atagcompletemenu [2] || url ==atagcompletemenu [3]||url ==atagcompletemenu [4]||url ==atagcompletemenu [5]||url ==atagcompletemenu [6]||url ==atagcompletemenu [7]||url ==atagcompletemenu [8])
    {
    ddaccordion.expandone('submenuheader',0)

    }

    if(url == atagcompletemenu [9] )
    {
    ddaccordion.expandone('submenuheader',1)

    }

    if (url == atagcompletemenu [10] || url == atagcompletemenu [11] || url == atagcompletemenu [12] || url == atagcompletemenu [13] || url == atagcompletemenu [14] || url == atagcompletemenu [21]|| url == atagcompletemenu [22]|| url == atagcompletemenu [23] || url == atagcompletemenu [24])
    {
    ddaccordion.expandone('submenuheader',1)

    }

    if (url == atagcompletemenu[16] || url == atagcompletemenu[17] ||url == atagcompletemenu[18] ||url == atagcompletemenu [19] ||url == atagcompletemenu [20] ||url == atagcompletemenu [21])
    {
    ddaccordion.expandone('submenuheader',1)

    }

    if (url == atagcompletemenu [25] || url == atagcompletemenu [26] || url == atagcompletemenu [27] || url == atagcompletemenu [28] || url == atagcompletemenu [29] || url == atagcompletemenu [30] || url == atagcompletemenu [31])
    {
    ddaccordion.expandone('submenuheader',2)

    }
    if (url == atagcompletemenu [32] ||url == atagcompletemenu [33] || url == atagcompletemenu [34] || url == atagcompletemenu [35] || url == atagcompletemenu [36] || url == atagcompletemenu [37])
    {
    ddaccordion.expandone('submenuheader',3)

    }
    if (url == atagcompletemenu [38] || url == atagcompletemenu [39] || url == atagcompletemenu [40] || url == atagcompletemenu [41] || url == atagcompletemenu [42] || url == atagcompletemenu [43] )
    {
    ddaccordion.expandone('submenuheader',4)

    }







    },
    onopenclose:function(header, index, state, isuseractivated)
    {


    if (state == "block" && isuseractivated == true)
    {
    window.location.replace(header.getAttribute('href'));

    }
    // if (state == "none" )
    // {alert (header.getAttribute('href'))}

    } // Navigating
    })

    ddaccordion.init({headerclass: "subexpandable",contentclass: "subcategoryitems",revealtype: "click",collapseprev: true, defaultexpanded: [],animatedefault: false ,persiststate: true, toggleclass: ["menuitem", ""], togglehtml: ["none", "", ""], animatespeed: "normal",
    oninit:function(headers, expandedindices)
    {
    var url = window.location.toString();

    var url1= window .location .toString();
    var divs = document .getElementById("glossymenu");
    var atags= divs.getElementsByTagName("a");

    for (var i=0; i<expandedindices.length; i++)
    {
    var expandedindex=expandedindices[i];
    headers[expandedindex].style.backgroundColor='#005500';
    headers[expandedindex].style.color='white';
    if (url1 == atags [0])
    {
    ddaccordion.collapseall('subexpandable');
    }
    if (url1 == atags [1] || url1 == atags [9]||url1 == atags [25]|| url1 == atags [32]|| url1 == atags [38] ) // collapsin the submenus of math on selecting a different content area
    {
    ddaccordion.collapseall('subexpandable');
    headers[expandedindex].style.backgroundColor='#c5d1eb';
    headers[expandedindex].style.color='#2A5192';
    }



    if (url1 !=headers[expandedindex])
    {
    if (url1 ==atags [10] || url1 ==atags [11] || url1 ==atags [12] || url1 ==atags [13] || url1 ==atags [14] || url1 ==atags [15] || url1 == atags [22] || url1 == atags [23] || url1 == atags [24]) // add all the menuitem indexes that dont have avy children under them
    {
    ddaccordion.collapseall('subexpandable');
    headers[expandedindex].style.backgroundColor='#c5d1eb';
    headers[expandedindex].style.color='#2A5192'
    }




    }




    }


    if (url == atags [16] || url == atags [17] || url == atags [18] || url == atags [19] || url == atags [20]||url == atags [21])
    {
    ddaccordion.expandone('subexpandable',0)
    }


    },
    onopenclose:function(header, index, state, isuseractivated)
    {
    if (state=="block" && isuseractivated==true)
    {window.location.replace(header.getAttribute('href'))}


    // if (state=="block" && isuseractivated==false)
    // {
    // //if header is expanded and NOT as the result of the user 's action (click or mouseover)
    // // header.style.backgroundColor="black"
    // // header.style.color="white"

    // }


    }






    })



    }

    I have been trying to solve this problem but have been unsuccessful so far
    Please advice ....

    you can also mail me on kartiksatti@gmail.com
    Thanks in advance ...
    Last edited by kartiksatti; 02-27-2009 at 05:17 PM.

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
  •