Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3999708
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:41:31+00:00 2026-05-20T07:41:31+00:00

Here my simple accordion : <script type=text/javascript> $(function() { $(dt.title).click(function() { $(div.info).slideUp(slow); $(this).next(div.info:hidden).slideDown(normal );

  • 0

Here my simple accordion :

<script type="text/javascript">
$(function()
{
    $("dt.title").click(function()
    { 
      $("div.info").slideUp("slow"); 
      $(this).next("div.info:hidden").slideDown("normal" );
    });
});
</script>

And it works fine with the this html :

<body>
<div id="wrapper">
<div id="container">

<ul id="nav">
<dt class="title"><a href="#">About</a></dt>
<dt class="title"><a href="#">Work</a></dt>
<div class="info">
<ul>
<li><a href="#">Bol</a></li>
<li><a href="#">Annie</a></li>
<li><a href="#">Imran</a></li>
</ul>
</div>
<dt class="title"><a href="#">Contact</a></dt>
<dt class="title"><a href="#">Links</a></dt>
</ul>
</div>
<div id="content">
</div>
</div>
</body>
</html> 

When I put the href links, the menu stops working. For example :

<dt class="title"><a href="about.html">About</a></dt> 

Also tell me how can I add the active and hover state in the menu.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:41:32+00:00Added an answer on May 20, 2026 at 7:41 am

    You forgot to return false

    <script type="text/javascript">
    $(function()
    {
        $("dt.title").click(function(){ 
            $("div.info").slideUp("slow"); 
            $(this).next("div.info:hidden").slideDown("normal" );
            return false; //do it here
        });
    });
    </script>
    <body>
        <div id="wrapper">
            <div id="container">
    
                <ul id="nav">
                    <dt class="title"><a href="#">About</a></dt>
                    <dt class="title"><a href="about.html">Work</a></dt>
                    <div class="info">
                        <ul>
                        <li><a href="#">Bol</a></li>
                        <li><a href="#">Annie</a></li>
                        <li><a href="#">Imran</a></li>
                        </ul>
                    </div>
                    <dt class="title"><a href="#">Contact</a></dt>
                    <dt class="title"><a href="#">Links</a></dt>
                </ul>
            </div>
            <div id="content">
            </div>
        </div>
    </body>
    

    If you are planning to load the content of about.html in content element then use load method. Your function will be something like

        $("dt.title").click(function(){ 
            $("div.info").slideToggle("slow");
            $('#content').load($(this).find('a').attr('href'));
            return false;
        });
    

    But this will not work for cross-domain url.

    [UPDATE]

    <script type="text/javascript">
    
    //no use for this var
    var loader = $("<div></div>").html('Loading')
    
    $(document).ready(function() {
    
        $(".title").click(function(){ 
    
            $(this).find("ul").slideToggle("slow");
    
            //do all the animations here
            //but using $.get, you will get more animation effect
            //I guess
    
            $('#content').load($(this).find('a').attr('href'));
    
            return false;
        });
    
        //similarly for inner link
        $(".title ul a").click(
            function ()
            {   
                $('#content').load($(this).attr('href'));
    
                return false;
        }); 
    
    });
    
    </script>
    <body>
    <div id="wrapper">
        <div id="container">
    
        <ul id="nav">   
        <dt class="title"><a href="test.php">About</a>
            <ul>
                    <li><a href="test.php">Bol</a></li>
                    <li><a href="test.php">Annie Khalid</a></li>
                    <li><a href="test.php">Imran</a></li>
            </ul>
        </dt>
    
        <dt class="title"><a href="test.php">Work</a>
            <ul>
                    <li><a href="test.php">Bol</a></li>
                    <li><a href="test.php">Annie Khalid</a></li>
                    <li><a href="test.php">Imran</a></li>
            </ul>
        </dt>
    
        <dt class="title"><a href="test.php">Contact</a>
            <ul>
                    <li><a href="test.php">Bol</a></li>
                    <li><a href="test.php">Annie Khalid</a></li>
                    <li><a href="test.php">Imran</a></li>
            </ul>
    
        </dt>    
    
        <dt class="title"><a href="test.php">Links</a>
            <ul>
                    <li><a href="test.php">Bol</a></li>
                    <li><a href="test.php">Annie Khalid</a></li>
                    <li><a href="test.php">Imran</a></li>
            </ul>
    
        </dt>
        </ul>    
    
        </div>
    
        <div id="content">      
        <p>Welcome to my site!!!!!!!!!!!!!!!!!!!!!!!</p>
    
        <p>In this tutorial we will be taking your average everyday website and enhancing it with jQuery.
         We will be adding ajax functionality so that the content loads into the relevant container instead
          of the user having to navigate to another page. We will also be integrating some awesome effects...
        </p>
        </div>
    
    </div>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a simple (hopefully) L10N question: Do all locales want this format: Sunday, Nov
I'm expanding on what used to be a pretty simple jQuery accordion script, and
Play with it here: http://jsbin.com/ocicu4/4/edit Simple Accordion, I only want one section open at
I found a simple JQuery accordion structure that uses DIV's rather than the typical
I'm probably missing something simple here, but I can't find the answer elsewhere. I
I am probably overlooking something really simple here but I am trying to redirect
No doubt I'm missing something really simple here but I just can't see the
Here is some simple Perl to count the number of times a value occurs
Here is a simple scenario with table characters: CharacterName GameTime Gold Live Foo 10
Here's a simple syntax question (I hope), I know how to constrain one generic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.