Wir bloggen zu vielen Themen rund um Typo3 und Java/J2EE

Navigation

Avatar of Joerg-Alexander StoehrJoerg-Alexander Stoehr - 04. Mai 2016 - Typo3 at xanders

Die Darstellung der Navigation beruht auf Media Queries. In Abhängigkeit der Bildschirmgröße werden die verschiedenen Navigationselemente ein- oder ausgeblendet.

HTML

<header class="main-head">
   <div id="mobile-menu">
      <f:cObject typoscriptObjectPath="page.10.MOBILE_BTN" />
      <div class="close-mobile-nav" ><a href="#"></a></div>
         <f:cObject typoscriptObjectPath="page.10.MOBILE_NAV" />
      </div>
      <f:cObject typoscriptObjectPath="page.10.MAIN_NAV" />
   </div>
</header>    
<f:cObject typoscriptObjectPath="page.10.SUB_NAV" />
<div id="content">
   <f:cObject typoscriptObjectPath="page.10.variables.CONTENT_CENTER" />
</div>
<footer></footer>    

CSS

/* main nav */

#main-nav  {
  float: right;
  margin: 19px 0 0 0;
}

#main-nav li {
  display: block;
  float: left;
  height: 30px;
}

#main-nav a {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  color: #444;
  display: block;
  border-right: 1px solid #87888b;
  line-height: 16px;
  margin: 0 16px 0 0;
  padding: 0 16px 0 0;
}

#main-nav a.active,
#main-nav a:hover,
#main-nav a:active,
#main-nav li:hover a {
  color: #8FB50B;
  background: transparent;
}

/* sub-nav */

#sub-nav {
  position: fixed;
  left: 0;
  top: 46px;
  background-color: #444444;
  max-width: none;
  width: 100%;
  height: 26px;
  line-height: 18px;
  z-index: 3000;
}

#sub-nav {
  background-color: #333;
  padding-top: 9px;
  height: 17px;
}

#sub-nav ul {
    margin: 2px auto 0;
    overflow: hidden;
    text-align: right;
    width: 984px;
}

#sub-nav li {
    display: inline;
    line-height: 19px;
    list-style-type: none;
}

#sub-nav a {
    border-left: 1px solid #FFFFFF;
    color: #FFFFFF;
    display: inline-block;
    font-size: 11px;
    line-height: 9px;
    margin: 0 0 0 16px;
    padding: 0 0 0 16px;
    text-transform: uppercase;
}

#sub-nav li:first-child a {
    border-left: medium none;
    margin-left: 0;
}

#sub-nav a.active,
#sub-nav a:hover,
#sub-nav a:active {
  color: #8FB50B;
  background: transparent;
}

/* mobile */

#mobile-menu {
  display: none;
  position: relative;
}

.mobile-btn {
  display: block;
  width: 40px;
  height: 23px;
  float: right;
  margin: 16px 16px 0 0;
  background: url(/fileadmin/templates/img/sprite.png) 0 -602px; width: 40px; height: 22px;
}

.mobile-btn.active {
  background: url(/fileadmin/templates/img/sprite.png) 0 -674px; width: 40px; height: 22px;
}

#mobile-menu .mobile-nav {
  background-color: rgba(0, 0, 0, 0.8);
  width: 188px;
  position: absolute;
  right: 0;
  top: 53px;
  display: none;
}

.mobile-nav ul {
  list-style-type: none;
}

.mobile-nav a {
  font-weight: bold;
  font-size: 14px;
  color: #fff;
  text-transform: uppercase;
  border-bottom: 1px solid #666;
  padding: 13px 15px 9px 15px;
  display: block;
}

.mobile-nav a.active {
  color: #97bf0c;
}

.mobile-sub {
  padding-bottom: 41px;
  border-bottom: 1px solid #666;
  display: none;
}

.mobile-sub a {
  font-weight: normal;
  font-size: 11px;
  border-bottom: none;
  padding: 15px 15px 3px 25px;
}


@media only screen and (max-width: 984px) {
    #mobile-menu {
        display: block;
    }
    #main-nav, #sub-nav {
        display: none !important;
    }
    #sub-nav ul, .main-head div {
        max-width: 652px;
        padding: 0;
        width: 652px;
    }
    #sub-nav ul {
        max-width: 620px;
        width: 620px;
    }
    #main-nav a {
        margin: 0 8px 0 0;
        padding: 0 8px 0 0;
    }
    #sub-nav a {
        margin: 0 0 0 8px;
        padding: 0 0 0 8px;
    }
    div.close-mobile-nav {
      background-color: rgba(0, 0, 0, 0.8);
      border-bottom: 1px solid #666666;
      display: none;
      right: 188px;
      position: absolute;
      top: 53px;
      height: 38px;
      width: 38px;
    }
    div.close-mobile-nav a {
        background: url("/fileadmin/templates/img/sprite.png") 0 -386px;
        display: block;
        margin: 10px;
        padding: 10px;
        position: relative;
    }
}

Archiv

2016 (5)

Mai (4) Januar (1)

2015 (2)

November (1) Mai (1)

2014 (1)

April (1)

2012 (3)

Mai (3)