Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. highlight the menu item according to the page

highlight the menu item according to the page

Scheduled Pinned Locked Moved Web Development
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 9106259
    wrote on last edited by
    #1

    hi i have different list in accordion format i want to highlight the list item according to the page

    • Hollywood
      • POP
      • Rock
      • Folk
      • Jazz
      • Country
      • Blues
    • Bollywood
      • POP
      • Rock
      • Folk
      • Jazz
      • Country
      • Hindu Stani
      • Film Songs

    the above list is the sample list and i am using bellow code $(document).ready(function($){ $('#accordion-4').dcAccordion({ eventType: 'hover', autoClose: true, saveState: true, disableLink: true, menuClose: false, speedIn:10, speedOut:10, showCount: false, }) }); can any one help to me.

    W 1 Reply Last reply
    0
    • U User 9106259

      hi i have different list in accordion format i want to highlight the list item according to the page

      • Hollywood
        • POP
        • Rock
        • Folk
        • Jazz
        • Country
        • Blues
      • Bollywood
        • POP
        • Rock
        • Folk
        • Jazz
        • Country
        • Hindu Stani
        • Film Songs

      the above list is the sample list and i am using bellow code $(document).ready(function($){ $('#accordion-4').dcAccordion({ eventType: 'hover', autoClose: true, saveState: true, disableLink: true, menuClose: false, speedIn:10, speedOut:10, showCount: false, }) }); can any one help to me.

      W Offline
      W Offline
      WoodenLegNamedSmith
      wrote on last edited by
      #2

      You could do this several way such as sending a numeric ID to a javascript function that corresponds to a link in your list. When clicked, and/or the page has done a round trip read that numeric ID back into a function that highlights that link. This is just a crude example of javascript that take an element's ID and turns its background bright Yellow.

      function highlight(linkID)
      {
      var link = document.getElementById(linkID);
      link.style.backgroundColor = "#FFFF00";
      }

      If you want to go about it in a STATIC way you could set up each page where the link itself has not only a CSS class definition but an ID as well, for example:

      • POP
      • Rock
      • Folk
      • Jazz
      • Country
      • Blues

      Now define your CSS

      .sub-menu { ..... }
      #CURRENT_PAGE { background-color:#FFFF00; }

      The choice is up to you, good luck!

      I once knew a man with a wooden leg named Smith, I never asked what he named his other leg.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups