ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Conditional based on url with an anchor link in text?

January 12, 2012 12:32pm

Subscribe [2]
  • #1 / Jan 12, 2012 12:32pm

    padstow

    101 posts

    I have a site where the client wants the sidebar navigation to jump to anchor links in the page’s text—I’ve set up those page sections as their own entries, so that they have their own url titles, etc…but now I would like to make the navigation items have an “active” class based on which anchor the user has clicked on…possible?  I know if there weren’t anchor links involved, it’d be a simple if conditional based with the segment id and the url title, but am at a loss with what to do when there’s a “#” involved… any help would be much appreciated!

    Thanks,
    Karen

  • #2 / Jan 12, 2012 2:18pm

    John St-Amand

    865 posts

    Sounds like you might need to search all segment for the presence of the currently active anchor: http://devot-ee.com/add-ons/segment-search

    Hope that helps.

  • #3 / Jan 15, 2012 11:56am

    padstow

    101 posts

    Very helpful, thanks John!  It’s close enough for what I need - too bad it can’t parse things like “url_title”, but maybe this will help talk my client out of using anchor tags for navigation in the first place 😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases