Drop Down Menus
For drop down menus, replace the navigation code in the layout file with this:
<nav id="navigation" class="navigation">
<cfset navCounter = 0>
<cfset navTotalCounter = 0>
<ul>
<!--- you can set this to the parentID in order to change toolbar (primary navigation) to display children of a different parent if you want to pull the main pages of the site, insert 0 as the ParentID --->
<cfset qry_toolbartop_ParentID = 0>
<!--- you can omit a page from being in the toolbar (primary navigation) by putting it's pageid here --->
<cfset qry_toolbartop_OMIT = 2350>
<!--- Query to grab the main pages of the website --->
<cfinclude template="#request.dir_globals#/layouts/qry_toolbarpages.cfm">
<!--- loop through the top level pages of the website --->
<cfoutput query="qry_toolbartop">
<!--- QUERY TO PULL DROP DOWN MENU --->
<cfquery name="qry_toolbarsub2" datasource="#request.dsn#" username="#request.dsn_username#" password="#request.dsn_password#">
SELECT fldPageID_PK, fldTitle, fldExternalLink, fldToolBarTitle, fldParentID, fldAlias
FROM tblPages
WHERE fldSiteID = '#REQUEST.SiteID#' AND fldParentID = #fldPageID_PK#
and fld_date_deleted IS NULL
ORDER BY fldSortID
</cfquery>
<cfset navTotalCounter = navTotalCounter + 1>
<cfif len(fldExternalLink) and not val(request.page_adminAccess)>
<cfset link2display = fldExternalLink>
<cfelseif val(qry_sitesecurity.fld_site_permalinks) and len(fldAlias)>
<cfset link2display = fldAlias>
<cfelse>
<cfset link2display = "#variables.baseHref##request.self#/PageID/#fldPageID_PK##request.addtoken#">
</cfif>
<cfif fldToolBarTitle is not "">
<cfset displayTitle = "#fldToolBarTitle#">
<cfelse>
<cfset displayTitle = "#fldTitle#">
</cfif>
<cfif fldPageID_PK EQ qry_pageinfo.fldParentID OR fldPageID_PK EQ qry_pageinfo.fldPageID_PK OR fldPageID_PK EQ qry_parentinfo.fldParentID>
<li><a href="#link2display#" class="active <cfif navTotalCounter EQ 1>first<cfelseif navTotalCounter EQ qry_toolbartop.recordcount>last</cfif>">#displayTitle# <cfif val(qry_toolbarsub2.recordcount)><div class="subnavOpen"><span class='ico-arrow-down'></span></div></cfif></a>
<cfelse>
<li><a href="#link2display#" <cfif navTotalCounter EQ 1>class="first"<cfelseif navTotalCounter EQ qry_toolbartop.recordcount>class="last"</cfif>>#displayTitle# <cfif val(qry_toolbarsub2.recordcount)><div class="subnavOpen"><span class='ico-arrow-down'></span></div></cfif></a>
</cfif>
<!--- DROP DOWN MENU --->
<cfif val(qry_toolbarsub2.recordcount)> <!--- loop #2 : Standard Dropdown --->
<div class="subnavMask">
<ul class="subNav">
<cfloop query="qry_toolbarsub2">
<cfif len(fldExternalLink) and not val(request.page_adminAccess)>
<cfset link2display = fldExternalLink>
<cfelseif val(qry_sitesecurity.fld_site_permalinks) and len(fldAlias)>
<cfset link2display = fldAlias>
<cfelse>
<cfset link2display = "#variables.baseHref##request.self#/PageID/#fldPageID_PK##request.addtoken#">
</cfif>
<cfif fldToolBarTitle is not "">
<cfset displayTitle = "#fldToolBarTitle#">
<cfelse>
<cfset displayTitle = "#fldTitle#">
</cfif>
<!--- if the page we've looped to is the parent of the current page, the current page, or grandparent of the current page --->
<cfif fldPageID_PK EQ qry_pageinfo.fldParentID OR fldPageID_PK EQ qry_pageinfo.fldPageID_PK OR fldPageID_PK EQ qry_parentinfo.fldParentID>
<li class="active"><a href="#link2display#">#displayTitle#</a></li>
<cfelse>
<li><a href="#link2display#">#displayTitle#</a></li>
</cfif>
</cfloop>
</ul>
</div>
</li>
<cfset navCounter = #navCounter# + 1>
</cfif>
</cfoutput>
</ul>
</nav><!--- END NAVIGATION --->
CSS
.navigation {
width: 70%;
display: table-cell;
vertical-align: middle;
z-index: 100;
text-align: right;
}
.navigation ul {
position: relative;
margin: 0 auto;
padding: 0;
list-style: none;
overflow: visible;
font-size: 0;
}
.navigation ul li {
display: inline-block;
}
.navigation > ul > li > a,
.navigation ul li {
text-align: center;
font-size: 16px;
}
.navigation > ul > li > a{
display: block;
padding: 8px 14px;
margin: 0;
color: #413d3a;
font-weight: normal;
line-height: 1;
text-decoration: none;
text-align: center;
transition:.12s cubic-bezier(.4,0,.2,1);
}
.navigation > ul > li:hover > a,
.navigation > ul > li > a.active {
color: #005a9c;
}
#navigation > ul > li .subNav {
position: absolute;
opacity: 0;
width: 200px;
min-width: 230px;
padding: 8px 0;
visibility: hidden;
background: #fff;
background: rgba(255,255,255,.95);
box-shadow: 0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);
transition: opacity .15s cubic-bezier(0,0,.2,1),
-webkit-transform .15s cubic-bezier(0,0,.2,1);
transition: transform .15s cubic-bezier(0,0,.2,1),
opacity .15s cubic-bezier(0,0,.2,1);
transition: transform .15s cubic-bezier(0,0,.2,1),
opacity .15s cubic-bezier(0,0,.2,1),
-webkit-transform .15s cubic-bezier(0,0,.2,1);
-webkit-transform: translateY(-12px);
-ms-transform: translateY(-12px);
transform: translateY(-12px);
overflow: hidden;
}
#navigation > ul > li:hover .subNav {
opacity: 1;
visibility: visible;
-webkit-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
#navigation > ul > li .subNav li {
display: block;
font-size: 15px;
font-weight: 500;
text-align: left;
}
#navigation > ul > li .subNav li a {
display: block;
padding: 14px 28px;
margin: 0;
color: #262626;
line-height: normal;
text-decoration: none;
transition: .15s cubic-bezier(0,0,.2,1);
}
#navigation > ul > li .subNav li a:hover {
color: #005a9c;
}
.subnavOpen {
display: none;
}
@media (max-width: 768px) {
.main-container{
transition: -webkit-transform .2s cubic-bezier(.4,0,.2,1);
transition: transform .2s cubic-bezier(.4,0,.2,1);
transition: transform .2s cubic-bezier(.4,0,.2,1),
-webkit-transform .2s cubic-bezier(.4,0,.2,1);
}
.main-container.navActive{
-webkit-transform: translate3d(-250px,0,0);
-ms-transform: translate3d(-250px,0,0);
transform: translate3d(-250px,0,0);
position: fixed;
}
.navigation {
position: fixed;
top: 0;
right: -250px;
visibility: hidden;
display: block;
margin: 0;
width: 250px;
max-width: 100%;
height: 100%;
max-height: 100%;
float: none;
transition: visibility 0s linear .15s;
overflow: hidden;
background: #f5f5f5;
z-index: -1;
}
.navigation.active {
visibility:visible;
transition:visibility 0s linear 0s;
overflow: scroll;
}
.navigation ul {
position:relative;
height:auto;
width:100%;
padding-top: 68px;
}
.navigation > ul > li {
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.navigation > ul > li:first-child {
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.navigation ul li,.navigation ul li a {
width: 100%;
display: block;
float: none;
margin: 0;
}
.navigation > ul > li > a {
position: relative;
width: 100%;
display: block;
float: none;
box-sizing: border-box;
margin: 0;
padding: 12px 20px;
font-size: 16px;
line-height: 24px;
text-align: left;
}
.navigation ul li a:hover {
border: none;
}
.subnavOpen {
position: absolute;
top: 0;
right: 0;
width: 60px;
font-size: 24px;
text-align: center;
}
.subnavOpen,
.subnavOpen span {
display: block;
height: 100%;
line-height: 48px;
}
.subnavOpen span {
width: 100%;
transition: .2s ease-out;
}
.subnavOpen.active {
}
.subnavOpen.active span {
-webkit-transform: rotateX(180deg);
transform: rotateX(180deg);
}
.subnavMask {
position: relative;
height: 0;
overflow: hidden;
transition: .3s ease-in-out;
}
#navigation > ul > li .subNav {
position: relative;
width: 100%;
opacity: 1;
-webkit-transform: none;
-ms-transform: none;
transform: none;
visibility: visible;
box-shadow: none;
background: #fff;
}
}
JavaScript
var navigation = (function() {
var el = $("navigation");
var button = $("menu");
var main = $("mainContainer");
var navOpen = false;
var open = function() {
el.addClassName("active");
button.addClassName("active");
main.addClassName("navActive");
navOpen = true;
};
var close = function() {
el.removeClassName("active");
button.removeClassName("active");
main.removeClassName("navActive");
navOpen = false;
};
var events = (function() {
button.on("click", function(event,element){
navOpen == false ? open() : close();
});
Event.observe(window, "resize", function() {
if (navOpen == true) { close() }
});
}());
return {
open: open,
close: close
}
}());
$("navigation").on("click", "li .subnavOpen", function(event, element) {
event.stop();
var li = element.up("li"),
subnavMask = li.down(".subnavMask").getHeight();
if (subnavMask == 0) {
li.down(".subnavMask").setStyle({
height: li.down("ul").getHeight() + "px"
});
li.down(".subnavOpen").addClassName("active");
} else {
li.down(".subnavMask").setStyle({
height: 0 + "px"
});
li.down(".subnavOpen").removeClassName("active");
};
});
subpages
- Auto Display Page Title
- Blog
- CSS Animations
- Drop Down Menu
- Email Subscription
- Google Fonts
- Google Maps API
- Header Videos
- Instagram Feed
- Layout Override
- On-Page Nav Scrolling
- Onecast / Latest Sermon
- Page Content
- Page Content Edit Buttons
- Parallax Scrolling
- Per Page SEO
- Permalink Conversion
- Popup Box
- Rotator / Event Box
- Sidebar Pop-out
- Site Search
- Slider
- Social Media Icons
- Split Navigation
- Staff Module
- Subpage Module
- TinyMCE Content Editor
- Twitter Feed
- Deprecated Add Ons