Solved

Jquery Accordion Menu question

Posted on 2010-11-29
3
294 Views
Last Modified: 2012-05-10
Hi Experts,
I am using this code i found at this site in my site

http://www.i-marco.nl/weblog/jquery-accordion-3/

and i am trying to use the first example STANDARD ACCORDION MENU

the menu works great except the sub headings, I want them to be a click able link. I changed the <a> tag to from "#" to working link but still if i click on the sub heading, It just displays the drop down menu but wont go the link.

how can i achieve both, I am think it has to do with the javascript.
here is the script for that menu

Thanks and appreciate it


jQuery.fn.initMenu = function() {  
    return this.each(function(){
        var theMenu = $(this).get(0);
        $('.acitem', this).hide();
        $('li.expand > .acitem', this).show();
        $('li.expand > .acitem', this).prev().addClass('active');
        $('li a', this).click(
            function(e) {
                e.stopImmediatePropagation();
                var theElement = $(this).next();
                var parent = this.parentNode.parentNode;
                if($(parent).hasClass('noaccordion')) {
                    if(theElement[0] === undefined) {
                        window.location.href = this.href;
                    }
                    $(theElement).slideToggle('normal', function() {
                        if ($(this).is(':visible')) {
                            $(this).prev().addClass('active');
                        }
                        else {
                            $(this).prev().removeClass('active');
                        }    
                    });
                    return false;
                }
                else {
                    if(theElement.hasClass('acitem') && theElement.is(':visible')) {
                        if($(parent).hasClass('collapsible')) {
                            $('.acitem:visible', parent).first().slideUp('normal', 
                            function() {
                                $(this).prev().removeClass('active');
                            }
                        );
                        return false;  
                    }
                    return false;
                }
                if(theElement.hasClass('acitem') && !theElement.is(':visible')) {         
                    $('.acitem:visible', parent).first().slideUp('normal', function() {
                        $(this).prev().removeClass('active');
                    });
                    theElement.slideDown('normal', function() {
                        $(this).prev().addClass('active');
                    });
                    return false;
                }
            }
        }
    );
});
};

$(document).ready(function() {$('.menu').initMenu();});

Open in new window

0
Comment
Question by:niceoneishere
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
jmatix earned 500 total points
Comment Utility
replace all:

return false;

with:

return true;

0
 
LVL 16

Assisted Solution

by:jmatix
jmatix earned 500 total points
Comment Utility
Also remove the line:

                e.stopImmediatePropagation();
0
 
LVL 1

Author Comment

by:niceoneishere
Comment Utility
Brilliant!!! thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
date format angularjs2 16 36
comparing strings that contain line breaks 18 34
Flexbox in CSS3 2 23
Different Delete Messages 7 4
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now