Hi there, please help, I am now desperate! I am converting a html theme to Concrete5 version 5.7.5.1. I am trying to style the autonav using the themes custom css but seem to be failing miserably. Could anyone possibly point me in the right direction as to where I am going wrong? Please bear in mind I am a designer more than developer so please go easy on me!
Here is the css, most of which I will not be using as I cannot figure out how to apply more than one colour to the autonav and will drop the megamenu as I have no idea how to make that an option either. Really I just need to know how to link this to the autonav view.php so it works.
/********************************************************COLOR************************************************/
.nicdark_menu > li > a:hover { color: #868585; }
.nicdark_menu > li > a { color: #a4a4a4; }
/*divider and triangle color*/
.nicdark_menu > .grey > a:after, .nicdark_menu > .grey .sub-menu li:first-child:before, .nicdark_menu > .grey .sub-menu li ul li:first-child:before{ color: #f9f9f9; }
.nicdark_menu > .greydark > a:after, .nicdark_menu > .greydark .sub-menu li:first-child:before, .nicdark_menu > .greydark .sub-menu li ul li:first-child:before{ color: #495052; }
.nicdark_menu > .green > a:after, .nicdark_menu > .green .sub-menu li:first-child:before, .nicdark_menu > .green .sub-menu li ul li:first-child:before{ color: #6fc191; }
.nicdark_menu > .blue > a:after, .nicdark_menu > .blue .sub-menu li:first-child:before, .nicdark_menu > .blue .sub-menu li ul li:first-child:before{ color: #74cee4; }
.nicdark_menu > .violet > a:after, .nicdark_menu > .violet .sub-menu li:first-child:before, .nicdark_menu > .violet .sub-menu li ul li:first-child:before{ color: #c389ce; }
.nicdark_menu > .orange > a:after, .nicdark_menu > .orange .sub-menu li:first-child:before, .nicdark_menu > .orange .sub-menu li ul li:first-child:before{ color: #ec774b; }
.nicdark_menu > .red > a:after, .nicdark_menu > .red .sub-menu li:first-child:before, .nicdark_menu > .red .sub-menu li ul li:first-child:before{ color: #e16c6c; }
.nicdark_menu > .yellow > a:after, .nicdark_menu > .yellow .sub-menu li:first-child:before, .nicdark_menu > .yellow .sub-menu li ul li:first-child:before{ color: #edbf47; }
/*dropdown*/
.nicdark_menu > .yellow > .sub-menu li{ background-color: #edbf47; }
.nicdark_menu > .grey > .sub-menu li{ background-color: #f9f9f9; }
/********************************************************COLOR************************************************/
.nicdark_menu > li > a:hover { color: #868585; }
.nicdark_menu > li > a { color: #a4a4a4; }
/*divider and triangle color*/
.nicdark_menu > .grey > a:after, .nicdark_menu > .grey .sub-menu li:first-child:before, .nicdark_menu > .grey .sub-menu li ul li:first-child:before{ color: #f9f9f9; }
.nicdark_menu > .greydark > a:after, .nicdark_menu > .greydark .sub-menu li:first-child:before, .nicdark_menu > .greydark .sub-menu li ul li:first-child:before{ color: #495052; }
.nicdark_menu > .green > a:after, .nicdark_menu > .green .sub-menu li:first-child:before, .nicdark_menu > .green .sub-menu li ul li:first-child:before{ color: #6fc191; }
.nicdark_menu > .blue > a:after, .nicdark_menu > .blue .sub-menu li:first-child:before, .nicdark_menu > .blue .sub-menu li ul li:first-child:before{ color: #74cee4; }
.nicdark_menu > .violet > a:after, .nicdark_menu > .violet .sub-menu li:first-child:before, .nicdark_menu > .violet .sub-menu li ul li:first-child:before{ color: #c389ce; }
.nicdark_menu > .orange > a:after, .nicdark_menu > .orange .sub-menu li:first-child:before, .nicdark_menu > .orange .sub-menu li ul li:first-child:before{ color: #ec774b; }
.nicdark_menu > .red > a:after, .nicdark_menu > .red .sub-menu li:first-child:before, .nicdark_menu > .red .sub-menu li ul li:first-child:before{ color: #e16c6c; }
.nicdark_menu > .yellow > a:after, .nicdark_menu > .yellow .sub-menu li:first-child:before, .nicdark_menu > .yellow .sub-menu li ul li:first-child:before{ color: #edbf47; }
/*dropdown*/
.nicdark_menu > .yellow > .sub-menu li{ background-color: #edbf47; }
.nicdark_menu > .grey > .sub-menu li{ background-color: #f9f9f9; }
.nicdark_menu > .greydark > .sub-menu li{ background-color: #495052; }
.nicdark_menu > .green > .sub-menu li{ background-color: #6fc191; }
.nicdark_menu > .blue > .sub-menu li{ background-color: #74cee4; }
.nicdark_menu > .violet > .sub-menu li{ background-color: #c389ce; }
.nicdark_menu > .orange > .sub-menu li{ background-color: #ec774b; }
.nicdark_menu > .red > .sub-menu li{ background-color: #e16c6c; }
/*tinynav*/
.nicdark_bg_burgundy .tinynav { color: #fff; background-color: #404547; box-shadow: 0px 4px 0px 0px #353b3d; }
.nicdark_bg_grey .tinynav { color: #a4a4a4; background-color: #f1f1f1; box-shadow: 0px 4px 0px 0px #e5e5e5; }
.nicdark_bg_greydark .tinynav { color: #fff; background-color: #404547; box-shadow: 0px 4px 0px 0px #353b3d; }
.nicdark_bg_yellow .tinynav { color: #fff; background-color: #e0b84e; box-shadow: 0px 4px 0px 0px #d4ae49; }
.nicdark_bg_orange .tinynav { color: #fff; background-color: #df764e; box-shadow: 0px 4px 0px 0px #d8734c; }
.nicdark_bg_red .tinynav { color: #fff; background-color: #c86969; box-shadow: 0px 4px 0px 0px #bf6363; }
.nicdark_bg_green .tinynav { color: #fff; background-color: #6ab78a; box-shadow: 0px 4px 0px 0px #65ae83; }
.nicdark_bg_blue .tinynav { color: #fff; background-color: #6fc4d9; box-shadow: 0px 4px 0px 0px #6dc0d5; }
.nicdark_bg_violet .tinynav { color: #fff; background-color: #ac7ab5; box-shadow: 0px 4px 0px 0px #a675af; }
/*border bottom li*/
.nicdark_menu > .yellow > .sub-menu li, .nicdark_megamenu.yellow ul li ol li a{ border-bottom:1px solid #e0b84e; }
.nicdark_menu > .grey > .sub-menu li, .nicdark_megamenu.grey ul li ol li a{ border-bottom:1px solid #f1f1f1; }
.nicdark_menu > .greydark > .sub-menu li, .nicdark_megamenu.greydark ul li ol li a{ border-bottom:1px solid #404547; }
.nicdark_menu > .green > .sub-menu li, .nicdark_megamenu.green ul li ol li a{ border-bottom:1px solid #6ab78a; }
.nicdark_menu > .blue > .sub-menu li, .nicdark_megamenu.blue ul li ol li a{ border-bottom:1px solid #6fc4d9; }
.nicdark_menu > .violet > .sub-menu li, .nicdark_megamenu.violet ul li ol li a{ border-bottom:1px solid #ac7ab5; }
.nicdark_menu > .orange > .sub-menu li, .nicdark_megamenu.orange ul li ol li a{ border-bottom:1px solid #df764e; }
.nicdark_menu > .red > .sub-menu li, .nicdark_megamenu.red ul li ol li a{ border-bottom:1px solid #c86969; }
/*text-dropdowncolor*/
.nicdark_menu .yellow .sub-menu a, .nicdark_menu .orange .sub-menu a, .nicdark_menu .red .sub-menu a, .nicdark_menu .blue .sub-menu a, .nicdark_menu .green .sub-menu a, .nicdark_menu .violet .sub-menu a, .nicdark_menu .greydark .sub-menu a { color: #fff; }
.nicdark_menu .white .sub-menu a, .nicdark_menu .grey .sub-menu a { color: #a4a4a4; }
/*shadow*/
.nicdark_menu > .grey .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #f1f1f1; }
.nicdark_menu > .greydark .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #404547; }
.nicdark_menu > .yellow .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #e0b84e; }
.nicdark_menu > .orange .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #df764e; }
.nicdark_menu > .red .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #c86969; }
.nicdark_menu > .blue .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #6fc4d9; }
.nicdark_menu > .green .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #6ab78a; }
.nicdark_menu > .violet .sub-menu li:last-child{ box-shadow: 0px 4px 0px 0px #ac7ab5; }
/*hover li bgcolor*/
.nicdark_menu > .yellow > .sub-menu li:hover, .nicdark_megamenu.yellow > ul > li > a{ background-color:#e0b84e; }
.nicdark_menu > .grey:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.grey > ul > li > a{ background-color:#f1f1f1; }
.nicdark_menu > .greydark:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.greydark > ul > li > a{ background-color:#404547; }
.nicdark_menu > .green:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.green > ul > li > a{ background-color:#6ab78a; }
.nicdark_menu > .blue:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.blue > ul > li > a{ background-color:#6fc4d9; }
.nicdark_menu > .violet:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.violet > ul > li > a{ background-color:#ac7ab5; }
.nicdark_menu > .orange:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.orange > ul > li > a{ background-color:#df764e; }
.nicdark_menu > .red:not(.nicdark_megamenu) > .sub-menu li:hover, .nicdark_megamenu.red > ul > li > a{ background-color:#c86969; }
/*megamenu border color*/
.nicdark_megamenu.grey ol li a{ border-right: 1px solid #f1f1f1; }
.nicdark_megamenu.greydark ol li a{ border-right: 1px solid #404547; }
.nicdark_megamenu.yellow ol li a{ border-right: 1px solid #e0b84e; }
.nicdark_megamenu.orange ol li a{ border-right: 1px solid #df764e; }
.nicdark_megamenu.red ol li a{ border-right: 1px solid #c86969; }
.nicdark_megamenu.blue ol li a{ border-right: 1px solid #6fc4d9; }
.nicdark_megamenu.green ol li a{ border-right: 1px solid #6ab78a; }
.nicdark_megamenu.violet ol li a{ border-right: 1px solid #ac7ab5; }
/*end color*/
/********************************************************BASIC************************************************/
.nicdark_menu * { margin: 0; padding: 0; list-style: none; }
.nicdark_menu { float: right; }
/*nicdark select*/
.tinynav{ float: left; font-size: 15px; display:none; padding: 10px; margin-top: 20px; font-family: 'Raleway', sans-serif; }
/*for menu fixed*/
.nicdark_navigation{ position:fixed; top:0; left:0; z-index: 99; -webkit-transition: all 0.8s ease; -moz-transition: all 0.8s ease; -o-transition: all 0.8s ease; -ms-transition: all 0.8s ease; transition: all 0.8s ease; }
.slowup{ margin-top: -34px; }
.slowdown{ margin-top: 0px; }
/*style full boxed*/
.nicdark_menu_fullwidth{ float: left; width: 100%; }
.nicdark_menu_boxed{ width:1220px; margin:auto; padding: 0px; }
/*dropdown position*/
.nicdark_menu .sub-menu li ul{ padding-left: 44px; padding-top: 0px; top: 0; left: 100%; }
/*triangle position*/
.nicdark_menu .sub-menu li:first-child:before{ z-index:-1; position: absolute; content: '\e8bf'; font-family: 'fontello'; margin-top: -25px; margin-left: 25px; font-size: 36px; }
.nicdark_menu .sub-menu li ul li:first-child:before{ z-index:-1; position: absolute; content: '\e8c0'; font-family: 'fontello'; margin-top: 5px; margin-left: -11px; font-size: 36px; }
/*arrow for sub-menu*/
.sf-with-ul:after{ content: '\ea76'; font-family: 'fontello'; margin-left:20px; font-size: 13px; }
/*radius and shadow*/
.nicdark_menu .sub-menu li:first-child{ border-radius: 5px 5px 0px 0px; }
.nicdark_menu .sub-menu li:last-child{ border-radius: 0px 0px 5px 5px; box-shadow: 0px 4px 0px 0px #e0b84e; }
/*first link*/
.nicdark_menu > li > a:after { content: '\e935'; font-family: 'fontello'; vertical-align: middle; font-size: 5px; margin: 0px 20px; }
.nicdark_menu > li:last-child > a:after { margin: 0px; display: none; }
.nicdark_menu > li > a:last-child{ margin-right: 10px; }
/*all link*/
.nicdark_menu a { display: block; position: relative; -webkit-transition: all 0.5s ease;-moz-transition: all 0.5s ease;-o-transition: all 0.5s ease;-ms-transition: all 0.5s ease;transition: all 0.5s ease;}
.nicdark_menu a { text-decoration: none; zoom: 1; font-family: 'Raleway', sans-serif; }
/*link in dropdown*/
.nicdark_menu li ul a { padding: 15px 25px; }
/*li tag*/
.nicdark_menu > li { float: left; }
.nicdark_menu li { white-space: nowrap; -webkit-transition: background .2s; transition: background .2s; position: relative; }
/*ul tag*/
.nicdark_menu ul { position: absolute; display: none; top: 100%; margin-left: -25px; z-index: 99; min-width: 12em; padding-top:40px; margin-top:0px; }
/*for dropdown active*/
.nicdark_menu li:hover > ul, .nicdark_menu li.sfHover > ul { display: block; }
/********************************************************MEGAMENU************************************************/
/*megamenu*/
.nicdark_megamenu{ position: initial !important;}
.nicdark_megamenu > ul{ /*position: fixed;*/ left: 50%; width: 1180px; margin-left: -590px; padding: 0px; margin-top: -30px; padding-top: 44px; }
.nicdark_megamenu ul > li{ display: inline-block !important; float: left; margin:0px !important; border-width: 0px !important; }
/*hide triangle*/
.nicdark_megamenu .sub-menu li:first-child:before{ display: none; }
/*first list*/
.nicdark_megamenu > ul > li:first-child > a:first-child{ border-radius: 5px 0px 0px 0px; }
.nicdark_megamenu > ul > li:first-child{ border-radius: 5px 0px 0px 0px 0px; }
.nicdark_megamenu > ul > li:last-child > a:first-child{ border-radius: 0px 5px 0px 0px; }
.nicdark_megamenu > ul > li:last-child{ border-radius: 0px 5px 0px 0px; }
/*title li*/
.nicdark_megamenu > ul > li > a{ padding: 15px 25px; text-transform: uppercase; }
/*second list ol*/
.nicdark_megamenu ol li{ border-width: 0px !important; border-radius: 0px !important; }
.nicdark_megamenu ul .mm_grid:first-child ol li:last-child{ border-radius: 0px 0px 0px 5px !important; }
.nicdark_megamenu ul .mm_grid:last-child ol li:last-child{ border-radius: 0px 0px 5px 0px !important; }
.nicdark_megamenu ul .mm_grid:last-child ol li a{ border-right-width: 0px !important; }
.nicdark_megamenu ol li a{ font-size: 15px; }
.nicdark_megamenu ol li a:before{ content: '\ea76'; font-family: 'fontello'; margin-right:20px; font-size: 13px; }
/*grid*/
.nicdark_megamenu > .sub-menu > .mm_grid:first-child{ border-radius: 5px 0px 0px 5px !important; }
.nicdark_megamenu > .sub-menu > .mm_grid:last-child{ border-radius: 0px 5px 5px 0px !important; }
/*grid megamenu*/
.nicdark_megamenu .mm_grid_3{ width: 295px; }
.nicdark_megamenu .mm_grid_4{ width: 393px; }
.nicdark_megamenu .mm_grid_6{ width: 590px; }
Here is the view.php as I have messed it up so far:
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navItems = $controller->getNavItems();
$c = Page::getCurrentPage();
/**
* The $navItems variable is an array of objects, each representing a nav menu item.
* It is a "flattened" one-dimensional list of all nav items -- it is not hierarchical.
* However, a nested nav menu can be constructed from this "flat" array by
* looking at various properties of each item to determine its place in the hierarchy
* (see below, for example $navItem->level, $navItem->subDepth, $navItem->hasSubmenu, etc.)
*
* Items in the array are ordered with the first top-level item first, followed by its sub-items, etc.
*
* Each nav item object contains the following information:
* $navItem->url : URL to the page
* $navItem->name : page title (already escaped for html output)
<?php defined('C5_EXECUTE') or die("Access Denied.");
$navItems = $controller->getNavItems();
$c = Page::getCurrentPage();
/**
* The $navItems variable is an array of objects, each representing a nav menu item.
* It is a "flattened" one-dimensional list of all nav items -- it is not hierarchical.
* However, a nested nav menu can be constructed from this "flat" array by
* looking at various properties of each item to determine its place in the hierarchy
* (see below, for example $navItem->level, $navItem->subDepth, $navItem->hasSubmenu, etc.)
*
* Items in the array are ordered with the first top-level item first, followed by its sub-items, etc.
*
* Each nav item object contains the following information:
* $navItem->url : URL to the page
* $navItem->name : page title (already escaped for html output)
* $navItem->target : link target (e.g. "_self" or "_blank")
* $navItem->level : number of levels deep the current menu item is from the top (top-level nav items are 1, their sub-items are 2, etc.)
* $navItem->subDepth : number of levels deep the current menu item is *compared to the next item in the list* (useful for determining how many <ul>'s to close in a nested list)
* $navItem->hasSubmenu : true/false -- if this item has one or more sub-items (sometimes useful for CSS styling)
* $navItem->isFirst : true/false -- if this is the first nav item *in its level* (for example, the first sub-item of a top-level item is TRUE)
* $navItem->isLast : true/false -- if this is the last nav item *in its level* (for example, the last sub-item of a top-level item is TRUE)
* $navItem->isCurrent : true/false -- if this nav item represents the page currently being viewed
* $navItem->inPath : true/false -- if this nav item represents a parent page of the page currently being viewed (also true for the page currently being viewed)
* $navItem->attrClass : Value of the 'nav_item_class' custom page attribute (if it exists and is set)
* $navItem->isHome : true/false -- if this nav item represents the home page
* $navItem->cID : collection id of the page this nav item represents
* $navItem->cObj : collection object of the page this nav item represents (use this if you need to access page properties and attributes that aren't already available in the $navItem object)
*/
/** For extra functionality, you can add the following page attributes to your site (via Dashboard > Pages & Themes > Attributes):
*
* 1) Handle: exclude_nav
* (This is the "Exclude From Nav" attribute that comes pre-installed with concrete5, so you do not need to add it yourself.)
* Functionality: If a page has this checked, it will not be included in the nav menu (and neither will its children / sub-pages).
*
* 2) Handle: exclude_subpages_from_nav
* Type: Checkbox
* Functionality: If a page has this checked, all of that pages children (sub-pages) will be excluded from the nav menu (but the page itself will be included).
*
* 3) Handle: replace_link_with_first_in_nav
* Type: Checkbox
* Functionality: If a page has this checked, clicking on it in the nav menu will go to its first child (sub-page) instead.
*
* 4) Handle: nav_item_class
* Type: Text
* Functionality: Whatever is entered into this textbox will be outputted as an additional CSS class for that page's nav item (NOTE: you must un-comment the "$ni->attrClass" code block in the CSS section below for this to work).
*/
/*** STEP 1 of 2: Determine all CSS classes (only 2 are enabled by default, but you can un-comment other ones or add your own) ***/
foreach ($navItems as $ni) {
$classes = array();
/*
if ($ni->isCurrent) {
//class for the page currently being viewed
$classes[] = 'nav-selected';
}
*/
/*
if ($ni->inPath) {
//class for parent items of the page currently being viewed
$classes[] = 'nav-path-selected';
}
*/
if ($ni->isFirst) {
//class for the first item in each menu section (first top-level item, and first item of each dropdown sub-menu)
$classes[] = 'orange sub-menu';
}
if ($ni->isLast) {
//class for the last item in each menu section (last top-level item, and last item of each dropdown sub-menu)
$classes[] = 'orange sub-menu';
}
if ($ni->hasSubmenu) {
//class for items that have dropdown sub-menus
$classes[] = 'nicdark_menu sub-menu orange';
}
/*
if (!empty($ni->attrClass)) {
//class that can be set by end-user via the 'nav_item_class' custom page attribute
$classes[] = $ni->attrClass;
}
*/
/*
if ($ni->isHome) {
//home page
$classes[] = 'nav-home';
}
*/
/*
//unique class for every single menu item
$classes[] = 'nav-item-' . $ni->cID;
*/
//Put all classes together into one space-separated string
$ni->classes = implode("nicdark_menu orange sub-menu", $classes);
}
//*** Step 2 of 2: Output menu HTML ***/
if (count($navItems) > 0) {
echo '<ul class="nicdark_menu sub-menu nicdark_margin010 nicdark_padding50">'; //opens the top-level menu
foreach ($navItems as $ni) {
echo '<li class="' . $ni->classes . '">'; //opens a nav item
echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';
if ($ni->hasSubmenu) {
echo '<ul>'; //opens a dropdown sub-menu
} else {
echo '</li>'; //closes a nav item
echo str_repeat('</ul></li>', $ni->subDepth); //closes dropdown sub-menu(s) and their top-level nav item(s)
}
}
echo '</ul>'; //closes the top-level menu
} else if (is_object($c) && $c->isEditMode()) { ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty Auto-Nav Block.')?></div>
<?php }
The menu and navigation use superfish.min.js and tinynav.min.js for their functionality. I have also attached two screenshots showing how the menu should look (as it does in the html version) and how it is looking at the moment using the autonav.
Realise I am asking a lot here, but would really appreciate and and all help!
Steve.
which is now giving the background colour to the drop boxes as desired. However, the first link in the second level drop down is still uncoloured and the shadow and arrow of the first dropdown is still all wrong (see attached).
Please help??