Commit 1c67b1ef authored by Ryan Wade's avatar Ryan Wade

cleaned up nav.php menu generation

fixed css menu system
added stylization
parent 09172653
/*NavBar*/
nav
{
/**width:1050px;
margin:10px 0px;
height:40px;
background:rgba(86, 170, 204, 0.75);
border:1px solid black;
border-radius: 5px;
-webkit-border-radius: 5px;**/
//margin-top: 25px;
font: 30px Georgia, serif;
color: black;
//margin:0px 0px 0px 0px;
text-align: right;
width: auto;
//float: right;
/*background:rgba(86, 170, 204, 0.75);*/
background:rgba(78, 153, 184, 1);
border-top:1px solid black;
border-bottom:1px solid black;
/*box-shadow: 0px 0px 9px rgba(0,0,0,0.15);*/
/*height:40px;*/
}
/**Top Level Nav**/
nav ul ul {
......@@ -18,84 +23,71 @@
display: block;
}
nav ul {
background:rgba(86, 170, 204, 0);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 10px;
margin: 0px;
padding: 0px 0px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
content: "";
clear: both;
display: block;
}
nav ul li {
float: left;
border-left:2px solid black;
border-right:2px solid black;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
background:rgba(86, 170, 204, 1);
animation: AnimLink .1s 1;
-webkit-animation: AnimLink .1s 1;
}
nav ul li a:hover {
background:rgba(86, 170, 204, 1);
animation: AnimLink .1s 1;
-webkit-animation: AnimLink .1s 1;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
display: block;
padding: 5px 20px;
text-decoration: none;
}
/**Submenu**/
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
background:rgba(78, 153, 184, 0.5);
/*background:rgba(86, 170, 204, 0.75);*/
border-radius: 0px 0px 0px 10px;
-webkit-border-radius: 0px 0px 0px 10px;
border: solid 1px black;
padding: 0px;
position: absolute;
top: 100%;
}
nav ul ul li {
border: none;
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li:hover {
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
border-top: solid 1px black;
}
nav ul ul li a:hover {
background: #4b545f;
}
/**Sub Submenu**/
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
/**#NavBar .subul_hidden
{
display: none;
}
.NavLink
{
margin:0px -6px 0px 0px;
padding:0px 10px 6px 10px;
border-left:2px solid black;
border-right:2px solid black;
background:rgba(86, 170, 204, 0);
}
.NavLink:hover
{
margin:0px -6px 0px 0px;
padding:0px 8px 6px 8px;
border-left:4px solid black;
border-right:4px solid black;
background:rgba(86, 170, 204, 1);
animation: AnimLink .1s 1;
-webkit-animation: AnimLink .1s 1;
border-radius: 0px;
-webkit-border-radius: 0px;
position: absolute;
left: 100%;
top:0;
}
.NavSelected
{
margin:0px -6px 0px 0px;
padding:0px 8px 6px 8px;
border-left:4px solid black;
border-right:4px solid black;
background:rgba(86, 170, 204, 1);
animation: AnimLink .1s 1;
-webkit-animation: AnimLink .1s 1;
......@@ -105,75 +97,20 @@
0%
{
background:rgba(86, 170, 204, 0);
border-left:2px solid black;
border-right:2px solid black;
padding:0px 10px 6px 10px;
}
100%
{
background:rgba(86, 170, 204, 1);
border-left:4px solid black;
border-right:4px solid black;
padding:0px 8px 6px 8px;
}
}**/
}
@-webkit-keyframes AnimLink /* Safari and Chrome */
{
0%
{
background:rgba(86, 170, 204, 0);
border-left:2px solid black;
border-right:2px solid black;
padding:0px 10px 6px 10px;
}
100%
{
background:rgba(86, 170, 204, 1);
border-left:4px solid black;
border-right:4px solid black;
padding:0px 8px 6px 8px;
}
}
/*Sidebar*/
#SideBar
{
display:inline-block;
width:50px;
margin:0px 10px 0px 0px;
padding:0px 0px 0px 0px;
vertical-align:top;
min-height:400px;
}
.verticalText
{
white-space:nowrap;
transform-origin:Right Center;
-webkit-transform-origin:Right Center;/*Chrome & Safari*/
-ms-transform-origin:Right Center; /*IE9*/
font:30px Georgia,serif;
}
.vNavLink
{
padding:2px 0px 2px 0px;
border-top:2px solid black;
border-bottom:2px solid black;
background:rgba(86, 170, 204, 0);
}
.vNavLink:hover
{
padding:0px;
border-top:4px solid black;
border-bottom:4px solid black;
background:rgba(86, 170, 204, 1);
animation: vAnimLink .1s 1;
-webkit-animation: vAnimLink .1s 1;
}
.vNavSelected
{
padding:0px;
border-top:4px solid black;
border-bottom:4px solid black;
background:rgba(86, 170, 204, 1);
animation: vAnimLink .1s 1;
-webkit-animation: vAnimLink .1s 1;
}
\ No newline at end of file
<script>
function addEnter(submenu)
{
$("#"+submenu).mouseenter(new function() {
$(this).toggleClass('subul_hidden subul_show');
});
}
function addLeave(submenu)
{
$("#"+submenu).mouseleave(new function() {
$(this).toggleClass('subul_show subul_hidden');
});
}
</script>
<nav id="navBar">
<?php
function SQL_QUERY_PARENT_ID($t_id,$t_SQL)
......@@ -29,11 +15,11 @@
return null;
return $Query;
}
function createLevel($level,$t_SQL,$t_select,$t_depth)
function createLevel($level,$t_SQL,$t_select)
{
if(!isset($level)||$t_depth == 0)
if(!isset($level))
return "";
$navbar = "\r\n<ul id='SubMenu".$level[0][1]."' class='topul'>\r\n";
$navbar = "\r\n<ul class='topul'>\r\n";
foreach($level as $page)
{
$id=$page[0];
......@@ -42,43 +28,17 @@
else
$linkType="NavLink";
$title=$page[2];
$navbar .= "<li id='NavId".$id."' class='topli ".$linkType."'><a href='viewpage.php?id=".$id."'>".$title."</a>";
$navbar .= "<li><a class='".$linkType."' href='viewpage.php?id=".$id."'>".$title."</a>";
if($page[0]!=0)
$navbar .= createSubLevel(SQL_QUERY_PARENT_ID($page[0],$t_SQL),$t_SQL,$t_select,$t_depth-1);
$navbar .= createLevel(SQL_QUERY_PARENT_ID($page[0],$t_SQL),$t_SQL,$t_select);
$navbar .= "</li>\r\n";
}
$navbar .= "</ul>\r\n";
return $navbar;
}
function createSubLevel($level,$t_SQL,$t_select,$t_depth)
{
$count = 0;
if(!isset($level)||$t_depth == 0)
return "";
$navbar = "\r\n<ul id='SubMenu".$level[0][1]."' class='subul_hidden'>\r\n";
foreach($level as $page)
{
$count++;
$id=$page[0];
if($id==$t_select)
$linkType="NavSelected";
else
$linkType="NavLink";
$title=$page[2];
$navbar .= "<li id='NavId".$id."' class='".$linkType."'><a href='viewpage.php?id=".$id."'>".$title."</a>";
if($page[0]!=0)
$navbar .= createSubLevel(SQL_QUERY_PARENT_ID($page[0],$t_SQL),$t_SQL,$t_select,$t_depth-1);
$navbar .= "</li>\r\n";
}
$navbar .= "</ul>\r\n";
if($count > 0)
return $navbar;
else
return "";
}
$nav_SQL = $_GLOBAL["SQL"];
$nav_id = $_GLOBAL["pageId"];
$level = createLevel(SQL_QUERY_PARENT_ID(0,$nav_SQL),$nav_SQL,$nav_id,2);
$level = createLevel(SQL_QUERY_PARENT_ID(0,$nav_SQL),$nav_SQL,$nav_id);
echo $level;
?>
</nav>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment