1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2009
    Rep Power

    Exclamation Help: menu redirecting to url on second mouse click

    Hello, along with a friend, we attempted to come up with a jquery (with ajax) code to try load a sub-child menu's href content (which usually points to a page) to the child menu when being on the homepage, with a menu hierarchy being parent -> child -> sub-child, where the latter is not visible when the homepage is active.

    However the problem is that we are having to click twice on the child menu to get it to load the page, when it should have worked with single click, and this problem is resulting only on the homepage, elsewhere in other pages, the display shows all 3 levels of menus, and have no problems clicking on the child loads the sub-child if it is present, else loads the page attached to it if no sub-child is present.

    See attached script.

    There are 2 functions, with the loadSubMenuHTML being used to call the submenus (child and subchild) while the initializeMenuLevel is used to first reset the display when changing menus, and secondly to add the menu id to a php session for other uses. In this part, at the end there is the "if (menuLevel >= 1 && IS_HOMEPAGE == 1)" condition to check if we are on the homepage, and thus hide the sub-child level (menu-level-2), and is called by the loadSubMenuHTML function.
    The primary menus are level 0, then the child level 1, and subchild level 2 in our case

    Since we are both not too well versed with jquery and ajax, can anyone help spot the "bug" which is resulting in the double click event being called for the homepage child menus...?
    Attached Files
    Last edited by lordrt21; May 4th, 2013 at 03:22 PM.

IMN logo majestic logo threadwatch logo seochat tools logo