Results 1 to 3 of 3

Thread: change class name if last navigation item is active

  1. #1
    New user
    Join Date
    06-23-09.
    Posts
    6

    Default change class name if last navigation item is active

    hello everyone,

    I've just startet to use typolight and and I'm very pleased so far!
    But right now, I'm struggling with the following problem:

    I've a main-navigation module (only 1 level). The last navigation item (if it's active) has the class "active" (the[*] tag), that's fine so far. But now, there is a second module (plain html - only a few div tags) right beneath the navigation module, which needs a class as well (only if the last navigation item is active).

    For example:
    Code:
    <ul>[*]Nav Item 1[*]Nav Item 2
         <li class="active">Nav Item 3[/list]
    
    
    <div id="header">
              <div id="headerTop" class="last"></div>
              <div id="headerContent"></div>
              <div id="headerBottom"></div>
    </div>
    In this example the div container "headerTop" has the class "last" if the last nav item is active.
    It's important to split this modules, I don't want to add the whole markup to the same module.

    Is there a way how to do this?

    By the way, is it possible to insert a whole module by using insert-tags (like "{{module_x}}")? I want to add the random picture module into my header module (which is plain html).

    Thanks in advance,

    Flurin

  2. #2
    User
    Join Date
    06-19-09.
    Location
    Elbl?g, Poland
    Posts
    152

    Default Re: change class name if last navigation item is active

    Quote Originally Posted by flumueller
    In this example the div container "headerTop" has the class "last" if the last nav item is active.
    It's important to split this modules, I don't want to add the whole markup to the same module.
    Is there a way how to do this?
    I don't think it's possible. If these navigations will be two different modules, showing on the same page everytime and only if last item in first one will be "active" then first item in second one will have "last" class. If it would be possible these modules should be releted in some way. But they aren't. Maybe few line of javascript can help you.


    Quote Originally Posted by flumueller
    By the way, is it possible to insert a whole module by using insert-tags (like "{{module_x}}")? I want to add the random picture module into my header module (which is plain html).
    Yes, of course. Don't be afraid inculding modules in this way - directly into template file or as a html content element.
    Marcin

    http://www.contao.pl - Polish Support Site
    http://forum.contao.pl - Polish Contao community forum


    -----------------------
    Need custom template? Feel free to contact me by e-mail marcin@contao.pl

  3. #3
    New user
    Join Date
    06-23-09.
    Posts
    6

    Default Re: change class name if last navigation item is active

    Thanks, I figured it out now, to include modules in a template by using the {{module.. tag.

    Furthermore I'd still be delighted if there is a chance to solve my problem with the navigation by customize the template / html file. JavaScript is really the worst case solution

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
  •