0

I am trying to show the last li as selected as well as initially I need to show its sub menu items also to be displayed.

So here is the Demo Link which I have tried.

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <title>Test Page</title>
        <link rel="stylesheet" href="styles/master.css" type="text/css" media="screen" title="no title" charset="utf-8">

        <script src="js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/modernizr-1.6.min.js" type="text/javascript" charset="utf-8"></script>

    </head>
    <body>
        <div class="page">
            <header>
                <figure>
                    <img src="images/logo.png" width="48" height="49" alt="Logo">
                    <figcaption>
                        <h1>Company Name</h1>
                    </figcaption>
                </figure>
                <nav>
                    <ul>
                        <li><a href="home.html">Home</a></li>
                        <li><a href="aboutus.html">About Us</a></li>
                        <li class="submenuHeader">
                            <a href="products.html">Products</a>
                            <ul class="submenu">
                                <li><a href="webpage.html">Web Page</a></li>
                                <li><a href="mobileapp.html">Mobile App</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </header>
            <section>
                <h1>Lorem Ipsum dolor</h1>
                <h3>Lorem Ipsum dolor sit ame</h3>
                <p>
                    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </p>
            </section>
            <form action="Test_submit" method="get" accept-charset="utf-8">
                <h3>Registration Form</h3>
                <label for="first_name">First Name</label><input type="text" name="first_name" value="" id="first_name">
                <label for="Email">Email</label><input type="text/submit/hidden/button" name="" value="" id="">
                <label for="country">Country</label><input type="text/submit/hidden/button" name="country" value="" id="country">
                <p><input type="submit" value="Submit" class="button"></p>
            </form>
        </div>
    </body>
</html>
Franz Noel
  • 1,820
  • 2
  • 23
  • 50
phani
  • 3
  • 2

2 Answers2

0

First of all, get rid of all the js errors before you post. Try using hosted jQuery link when you post online as people don't have access to your local directories.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

Add something like this to the head section:

$(document).ready(function () {
      $('ul.submenu').css({'display':'block'});
});

You might want to change the selectors to make it more dynamic. What I have posted is just to give you an idea. Also, don't forget to make changes to the sub-menu items CSS.

Learner
  • 3,904
  • 6
  • 29
  • 44
0

In order to show an active selection on a link list, you will need to change "active" class for each page.

In this case below, "Products" Menu is set to "active" and "Web Page" SubMenu links are set to "active-submenu".

<ul>
  <li><a href="home.html">Home</a></li>
  <li><a href="aboutus.html">About Us</a></li>
  <li class="submenuHeader active"><a href="products.html">Products</a>
    <ul class="submenu">
      <li class="active-submenu"><a href="webpage.html">Web Page</a></li>
      <li><a href="mobileapp.html">Mobile App</a></li>
    </ul>
  </li>
</ul>

Here is the css code for "active" class above. Which all active class will have a bold class.

.active {
  font-weight: bold;
}
.active-submenu {
  font-weight: bold;
  color: blue;
}

So, on each .html file that you have, it will change the appearance to bold those who have an "active" class.

If you are interested in changing the classes dynamically, you might need to use javascript/jQuery to "add a class" or "change a class". Here is the link if you are ready - jquery change class name.

Community
  • 1
  • 1
Franz Noel
  • 1,820
  • 2
  • 23
  • 50