Results 1 to 1 of 1

Thread: hover styles should stay onclick on multilevel menu loading dynamically

  1. #1
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default hover styles should stay onclick on multilevel menu loading dynamically

    I have used the below script to create multilevel megamenu with a lot of customizations.

    Below is the JsFiddle link for the same.

    http://jsfiddle.net/DL7Xm/

    Below is the CSS code for the same.

    Code:
        /* ######### Drop Down DIVs CSS ######### */
        
        
        .ddsubmenustyle, .ddsubmenustyle div{ /*topmost and sub DIVs, respectively*/
        font: normal 13px Verdana;
        margin: 0;
        padding: 0;
        position: absolute;
        left: 0;
        top: 0;
        list-style-type: none;
        background: transparent;
        border:none;
        border-left: 2px solid #ffffff;
        border-bottom-width: 0;
        visibility: hidden;
        z-index: 100;
        }
        
        .ddsubmenustyle ul{
        margin: 0;
        padding: 0;
        position: absolute;
        left: 0;
        top: 0;
        list-style-type: none;
        border: 0px none;
        }
        
        .ddsubmenustyle li a{
        display: block;
        width: 170px; /*width of menu (not including side paddings)*/
        color: #09519b;
        background-color: #d6d6d6;
        text-decoration: none;
        padding: 8px 0px 8px 13px;
        
        }
        
        * html .ddsubmenustyle li{ /*IE6 CSS hack*/
        display: inline-block;
        width: 170px; /*width of menu (include side paddings of LI A*/
        }
        
        .ddsubmenustyle li a:hover{
        font-weight:bold;
        background-color:#bfbfbf;
        }
        
        /* ######### Neutral CSS  ######### */
        
        .downarrowpointer{ /*CSS for "down" arrow image added to top menu items*/
        padding-left: 4px;
        border: 0;
        }
        
        .rightarrowpointer{ /*CSS for "right" arrow image added to drop down menu items*/
        position: absolute;
        padding-top: 3px;
        left: 100px;
        border: 0;
        }
        
        /* ######### Marker List Vertical Menu ######### */
        
        .markermenu{
        width: 175px; /*width of side bar menu*/
        clear: left;
        /*position: relative;*/ /*Preserve this for "right" arrow images (added by script) to be positioned correctly*/
        position: absolute;
        top:136px;
        
        }
        
        .markermenu ul{
        list-style-type: none;
        margin: 56px 0 0 0;
        padding: 0;
        /*border: 1px solid #9A9A9A;*/
        }
        
        .markermenu ul li a{
        background: #d6d6d6; /*light gray background*/
        color: #09519b !important;
        display: block;
        width: auto;
        padding: 8px 0;
        padding-left: 13px;
        text-decoration: none;
        /*border-bottom: 1px solid #B5B5B5;*/
        }
        
        .topRound{
        	border-radius:5px 5px 0 0;
        }
        
        .bottomRound{
        	border-radius:0 0 5px 5px;
        }
        
        * html .markermenu ul li a{ /*IE6 hack*/
        width: 155px;
        }
        
        .markermenu ul li a:visited, .markermenu ul li a:active{
        color: #00014e;
        }
        
        .markermenu ul li a:hover, .markermenu ul li a.selected{
         font-weight:bold;
         background-color:#bfbfbf;
        }
        
        
        /* ######### Customized Drop Down ULs CSS (inherits from ddlevelsmenu-base.css) ######### */
        
        .blackwhite li a{
        background: white;
        }
        
        .blackwhite li a:hover{
        background: black;
        color: white;
        }
        
        ul.miniBlocks{width:732px !important; background:#d6d6d6;}
        ul.miniBlocks1{width:366px !important; background:#d6d6d6;}
        .miniBlocks li{float:left !important;}
        .miniBlocks1 li{float:left !important;}
        
        .mattblackmenu a.selected, .ddsubmenustyle li.selected > a {
        background: #bfbfbf; /*background of tab with "selected" class assigned to its LI */
        color: #09519B;
        font-weight:bold;
        }
    The script and css are working fine. When you move on to the navigation items, you can see the mouse over selection with a darker background color and font bold.

    Now, this menu is coming dynamically from a js/jsp include file.

    What I need is when a user wants to open up a page, onclick of it, the hover style should stay.

    For instance,

    If you mouse over on JavaScript Reference > Item Folder 5b > Item Folder 5.2b > Sub Item 5.2.1b and when you want to open Sub Item 5.2.1b, onclick of it, when the page relevant to Sub Item 5.2.1b opens, the hover style should stay on click for the user to know that he is on Sub Item 5.2.1b page when he again wants to hover and open another page or see on what page is he on.

    Any other ways are welcomed, but should work on my dynamic scenario.
    Last edited by keyboard; 11-25-2013 at 07:20 AM. Reason: Format: Code Tags [code][/code]

Similar Threads

  1. balloontooltip stay on position on hover
    By davelf in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 12-07-2011, 07:48 AM
  2. Replies: 1
    Last Post: 02-21-2011, 04:37 AM
  3. Anylink dropdownmenu can menus stay open onclick if using mouseover?
    By maraxus in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 12-21-2006, 03:28 AM
  4. Dynamically switch styles
    By Echos in forum CSS
    Replies: 10
    Last Post: 12-02-2005, 07:48 PM
  5. a.dropMenu:hover not working w/onClick & AnyLink Drop Down Menu
    By jbrenny in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-28-2005, 09:10 PM

Tags for this Thread

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
  •