Skip navigation
Currently Being Moderated

Active class on main menu using templates or library items

Jul 20, 2012 4:25 PM

Is there a way to include the main menu of a website in a template or a library item and be able to put a class of active on the current page? Since both templates and library items funciton by applying the whats in them across the entire site, and the active class will only be on an individual page I have been unable to figure out a way to do this.

 
Replies
  • Currently Being Moderated
    Jul 20, 2012 6:00 PM   in reply to Exley22

    In CSS, active means onmouseclick (the momentary action of clicking a mouse button when the cursor is pointing to a link).

     

    I think what you're looking for is actually a persistent page indicator.

     

    http://alt-web.com/Articles/Persistent-Page-Indicator.shtml

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 3:34 AM   in reply to Exley22

    Exley22 wrote:

     

    Your link does not answer my question regarding how to do this withing templates or library items though

    It does the way I read it.

     

    "NOTE: To make the body class editable in a Dreamweaver Template (.dwt), you'll need to specify an editable tag attribute in your Template (click on screenshots below for details)."

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 3:46 AM   in reply to Exley22

    There is also a method that compares the url with the link and if both are the same it will automatically give the menu item an active class.

     

    That method has been used here http://accufire.com.au/

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 4:03 AM   in reply to Exley22

    No, it is not the same, but I did not mean to confuse the issue, just supply an alternative if desired.

     

    Nancy's (alt-web) way is to give each of the links a unique class and apply style rules to those classes.

     

    To summarise the differences

    • Nancy: (for want a better name): you need to physically attach a class to each menu item
    • Accufire: attaching a class to the current menu item is done automatically.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 11:11 AM   in reply to Exley22

    Either method will work with any CSS menu be it Spry, jQuery, PVII, etc...

     

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points