Start a new discussion
To start a new discussion please visit the discussions section of the GitHub home page of the project.
You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.
Reply To: Lost mobile animation effect
Home › Forums › Older releases › 1.0.x › Lost mobile animation effect › Reply To: Lost mobile animation effect
October 6, 2017 at 17:26
#3728
felicks
Participant
My apologies! Our school district controls the internet filter so I cannot change it… I will do my best to post the code below:
HTML:
<nav class="main-navwrapper" role="navigation">
<div class="main-nav">
<!-- Mobile menu toggle button (hamburger/x icon) -->
<input id="main-menu-state" type="checkbox" />
<label class="main-menu-btn" for="main-menu-state"> <span class="main-menu-btn-icon"></span>Toggle main menu visibility</label>
<p class="nav-brand">MENU</p>
<div class="w3-rightmenu">
<a href="http://www.facebook.com/HeartlandEd/timeline?"><img alt="FB logo" height="48" src="../images/FB64trans.png" width="48" /></a>
<a href="http://www.twitter.com/HeartlandEd"><img alt="Twitter logo" height="48" src="../images/TW64transr.png" width="48" /></a>
<a href="http://www.instagram.com/heartland_ed"><img alt="Instagram logo" height="48" src="../images/instagram64t.png" width="48" /></a>
</div>
<ul id="main-menu" class="sm sm-blue">
<li><a href="../" target="_self">HOME</a></li>
<li><a href="#" target="_self">ABOUT US</a>
<ul>
<li><a href="../pages/aboutus.htm" target="_self">Overview</a></li>
<li><a href="../about/board.htm" target="_self">Our Board</a></li>
<li><a href="../about/staff.htm" target="_self">Staff Directory</a></li>
<li><a href="../about/location.htm" target="_self">Location</a></li>
<li><a href="../about/rooms.htm" target="_self">Training Rooms</a></li>
<li><a href="../about/policies.htm" target="_self">Website Policies</a></li>
</ul>
</li>
<li><a href="#" target="_self">PROGRAMS</a>
<ul>
<li><a href="../pages/programs.htm" target="_self">Overview</a></li>
<li><a href="../programs/pd.htm" target="_self">Professional Development</a></li>
<li><a href="../STEM">STEM Scholars</a></li>
<li><a href="../programs/online.htm" target="_self">Online Courses</a>
<ul>
<li><a href="../programs/ace.htm" target="_self">American College of Education</a></li>
<li><a href="../programs/ascd.htm" target="_self">ASCD Educore</a></li>
<li><a href="../programs/intelteach.htm" target="_self">Intel Teach</a></li>
<li><a href="../programs/teachingpoint.htm" target="_self">Teaching Point</a></li>
<li><a href="../programs/uphoenix.htm" target="_self">University of Phoenix</a></li>
</ul>
</li>
<li><a href="../programs/leadership.htm" target="_self">Leadership Conference</a></li>
<!--<li><a href="../programs/newteacher.htm" target="_self">Recruitment Fair</a></li>//-->
</ul>
</li>
<li><a href="#" target="_self">OUR REGION</a>
<ul>
<li><a href="../pages/region.htm" target="_self">Overview</a></li>
<li><a href="../region/partners.htm" target="_self">HEC Partners</a></li>
<li><a href="../region/legislative.htm" target="_self">Legislative Network</a></li>
<li><a href="../region/workforce.htm" target="_self">Workforce Network</a></li>
<li><a href="../region/news.htm" target="_self">District News</a></li>
</ul>
</li>
<li><a href="#" target="_self">RESOURCES</a>
<ul>
<li><a href="../pages/resources.htm" target="_self">Overview</a></li>
<li><a href="../resources/teacher.htm" target="_self">Teacher Resources</a></li>
<li><a href="../resources/education.htm" target="_self">Education Links</a></li>
<li><a href="../resources/subject.htm" target="_self">Subject Resources</a></li>
</ul>
</li>
<li><a href="#" target="_self">EMPLOYMENT</a>
<ul>
<li><a href="../pages/employment.htm" target="_self">Overview</a></li>
<li><a href="../employment/jobs.htm" target="_self">Job Openings</a></li>
<li><a href="http://www.applitrack.com/heartlanded/onlineapp/">Application</a></li>
<!--<li><a href="../employment/newteacher.htm" target="_self">Recruitment Fair</a></li>//-->
</ul>
</li>
</ul>
</div>
</nav>
CSS: using sm-core-css.css and modified sm-blue2.css below–
@import url('http://fonts.googleapis.com/css?family=Montserrat:400,700');
.main-nav {
background-position: 0% 0%;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
background-image: linear-gradient(to bottom, #3298c8, #2e8cb8);
background-color: #3092c0;
background-repeat: repeat;
background-attachment: scroll;
}
.main-navwrapper {
height:50px;
}
.main-nav:after {
clear: both;
content: "\00a0";
display: block;
height: 0;
font: 0px/0 serif;
overflow: hidden;
}
#main-menu {
clear: both;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* Mobile menu top separator */
#main-menu:before {
content: '';
display: block;
height: 1px;
font: 1px/1px sans-serif;
overflow: hidden;
background: #2e8cb8;
}
@media (min-width: 768px) {
#main-menu:before {
display: none;
}
}
/* Mobile menu toggle button */
.main-menu-btn {
float: left;
margin: 10px;
position: relative;
display: inline-block;
width: 29px;
height: 29px;
text-indent: 29px;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* hamburger icon */
.main-menu-btn-icon, .main-menu-btn-icon:before, .main-menu-btn-icon:after {
position: absolute;
top: 50%;
left: 2px;
height: 2px;
width: 24px;
background: #fff;
-webkit-transition: all 0.25s;
transition: all 0.25s;
}
.main-menu-btn-icon:before {
content: '';
top: -7px;
left: 0;
}
.main-menu-btn-icon:after {
content: '';
top: 7px;
left: 0;
}
/* x icon */
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon {
height: 0;
background: transparent;
}
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before {
top: 0;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after {
top: 0;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
/* hide menu state checkbox (keep it visible to screen readers) */
#main-menu-state {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
}
/* hide the menu in mobile view */
#main-menu-state:not(:checked) ~ #main-menu {
display: none;
}
#main-menu-state:checked ~ #main-menu {
display: block;
}
@media (min-width: 868px) {
/* hide the button in desktop view */
.main-menu-btn {
position: absolute;
top: -99999px;
}
/* always show the menu in desktop view */
#main-menu-state:not(:checked) ~ #main-menu {
display: block;
}
}
.sm-blue {
background: transparent;
}
.sm-blue a, .sm-blue a:hover, .sm-blue a:focus, .sm-blue a:active {
/* make room for the toggle button (sub indicator) */
background-position: 0% 0%;
padding-right: 50px;
color: black;
font-family: Montserrat, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: normal;
line-height: 23px;
text-decoration: none;
padding-left: 20px;
padding-top: 10px;
padding-bottom: 10px;
background: #B4D1E2;
background-color: #B4D1E2;
background-repeat: repeat;
background-attachment: scroll;
}
.sm-blue a.current {
background: #002163;
color: white;
}
.sm-blue a.disabled {
color: #a1d1e8;
}
.sm-blue a span.sub-arrow {
position: absolute;
top: 50%;
margin-top: -17px;
left: auto;
right: 4px;
width: 34px;
height: 34px;
overflow: hidden;
font: bold 16px/34px monospace !important;
text-align: center;
background: rgba(0, 0, 0, 0.1);
}
.sm-blue a.highlighted span.sub-arrow:before {
display: block;
content: '-';
}
.sm-blue ul {
z-index: 9999;
background: white;
}
.sm-blue ul ul {
background: rgba(102, 102, 102, 0.1);
}
.sm-blue ul a, .sm-blue ul a:hover, .sm-blue ul a:focus, .sm-blue ul a:active {
background: transparent;
color: #002163;
font-size: 14px;
font-variant: normal;
border-left: 8px solid transparent;
}
.sm-blue ul a:hover, .sm-blue ul a:focus, .sm-blue ul a:active, .sm-blue ul a.highlighted {
background: #002163;
color: white;
}
.sm-blue ul a.current {
background: #002163;
color: white;
}
.sm-blue ul a.disabled {
color: #b3b3b3;
}
.sm-blue ul ul a, .sm-blue ul ul a:hover, .sm-blue ul ul a:focus, .sm-blue ul ul a:active {
border-left: 16px solid transparent;
}
.sm-blue ul ul ul a, .sm-blue ul ul ul a:hover, .sm-blue ul ul ul a:focus, .sm-blue ul ul ul a:active {
border-left: 24px solid transparent;
}
.sm-blue ul ul ul ul a, .sm-blue ul ul ul ul a:hover, .sm-blue ul ul ul ul a:focus, .sm-blue ul ul ul ul a:active {
border-left: 32px solid transparent;
}
.sm-blue ul ul ul ul ul a, .sm-blue ul ul ul ul ul a:hover, .sm-blue ul ul ul ul ul a:focus, .sm-blue ul ul ul ul ul a:active {
border-left: 40px solid transparent;
}
.sm-blue ul li {
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.sm-blue ul li:first-child {
border-top: 0;
}
.nav-brand {
float: left;
margin: 0;
display: block;
padding: 10px 10px 10px 10px;
color: #fff;
font-family: Montserrat, Arial, Helvetica, sans-serif;
font-size: 1.2em;
font-weight: normal;
line-height: 29px;
text-decoration: none;
}
@media (min-width: 868px) {
/* Switch to desktop layout
-----------------------------------------------
These transform the menu tree from
collapsible to desktop (navbar + dropdowns)
-----------------------------------------------*/
/* start... (it's not recommended editing these rules) */
#main-menu {
width: 100%;
}
#main-menu > li {
float: none !important;
display: table-cell !important;
width: 1% !important;
text-align: center !important;
}
.sm-blue ul {
z-index: 9999;
position: absolute;
width: 12em;
}
.sm-blue li {
float: left;
}
.sm-blue.sm-rtl li {
float: right;
}
.sm-blue ul li, .sm-blue.sm-rtl ul li, .sm-blue.sm-vertical li {
float: none;
}
.sm-blue a {
white-space: nowrap;
}
.sm-blue ul a, .sm-blue.sm-vertical a {
white-space: normal;
}
.sm-blue .sm-nowrap > li > a, .sm-blue .sm-nowrap > li > :not(ul) a {
white-space: nowrap;
}
/* ...end */
.sm-blue {
background-position: 0% 0%;
background-color: #B4D1E2;
background-repeat: repeat;
background-attachment: scroll;
}
.sm-blue a, .sm-blue a:hover, .sm-blue a:focus, .sm-blue a:active, .sm-blue a.highlighted {
padding: 13px 24px;
background: #B4D1E2;
color: black;
}
.sm-blue a:hover, .sm-blue a:focus, .sm-blue a:active, .sm-blue a.highlighted {
background: #002163;
color: white;
}
.sm-blue a.current {
background: #002163;
color: white;
}
.sm-blue a.disabled {
background: #002163;
color: #a1d1e8;
}
.sm-blue a span.sub-arrow {
top: auto;
margin-top: 0;
bottom: 2px;
left: 50%;
margin-left: -5px;
right: auto;
width: 0;
height: 0;
border-width: 5px;
border-style: solid dashed dashed dashed;
border-color: #000 transparent transparent transparent;
background: transparent;
}
.sm-blue a.highlighted span.sub-arrow:before {
display: none;
}
.sm-blue > li:first-child {
border-left: 0;
}
.sm-blue ul {
z-index: 9999;
border: 1px solid #a8a8a8;
padding: 7px 0;
background: white;
}
.sm-blue ul ul {
background: white;
}
.sm-blue ul a, .sm-blue ul a:hover, .sm-blue ul a:focus, .sm-blue ul a:active, .sm-blue ul a.highlighted {
border: 0 !important;
padding: 9px 23px;
background: transparent;
color: #002163;
}
.sm-blue ul a:hover, .sm-blue ul a:focus, .sm-blue ul a:active, .sm-blue ul a.highlighted {
background: #002163;
color: white;
}
.sm-blue ul a.current {
background: #002163;
color: white;
}
.sm-blue ul a.disabled {
background: white;
color: #b3b3b3;
}
.sm-blue ul a span.sub-arrow {
top: 50%;
margin-top: -5px;
bottom: auto;
left: auto;
margin-left: 0;
right: 10px;
border-style: dashed dashed dashed solid;
border-color: transparent transparent transparent #A3C7DC;
}
.sm-blue ul li {
border: 0;
}
.sm-blue span.scroll-up, .sm-blue span.scroll-down {
position: absolute;
display: none;
visibility: hidden;
overflow: hidden;
background: white;
height: 20px;
}
.sm-blue span.scroll-up-arrow, .sm-blue span.scroll-down-arrow {
position: absolute;
top: -2px;
left: 50%;
margin-left: -8px;
width: 0;
height: 0;
overflow: hidden;
border-width: 8px;
border-style: dashed dashed solid dashed;
border-color: transparent transparent #2b82ac transparent;
}
.sm-blue span.scroll-down-arrow {
top: 6px;
border-style: solid dashed dashed dashed;
border-color: #2b82ac transparent transparent transparent;
}
.sm-blue.sm-rtl.sm-vertical a span.sub-arrow {
right: auto;
left: 10px;
border-style: dashed solid dashed dashed;
border-color: transparent #a1d1e8 transparent transparent;
}
.sm-blue.sm-rtl > li:first-child {
border-left: 1px solid #2b82ac;
}
.sm-blue.sm-rtl > li:last-child {
border-left: 0;
}
.sm-blue.sm-rtl ul a span.sub-arrow {
right: auto;
left: 10px;
border-style: dashed solid dashed dashed;
border-color: transparent #A3C7DC transparent transparent;
}
.sm-blue.sm-vertical {
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.sm-blue.sm-vertical a {
padding: 9px 23px;
}
.sm-blue.sm-vertical a span.sub-arrow {
top: 50%;
margin-top: -5px;
bottom: auto;
left: auto;
margin-left: 0;
right: 10px;
border-style: dashed dashed dashed solid;
border-color: transparent transparent transparent #a1d1e8;
}
.sm-blue.sm-vertical > li {
border-left: 0 !important;
}
.sm-blue.sm-vertical ul a {
padding: 9px 23px;
}
.nav-brand {
display: none;
}
.w3-rightmenu a {
display: none;
}
}
Javascript: using jquery.smartmenus.js and additional javascript file below–
$(function() {
$('#main-menu').smartmenus({
subMenusSubOffsetX: 1,
subMenusSubOffsetY: -8
});
});
$(function() {
var $mainMenuState = $('#main-menu-state');
if ($mainMenuState.length) {
// animate mobile menu
$mainMenuState.change(function(e) {
var $menu = $('#main-menu');
if (this.checked) {
$menu.hide().slideDown(250, function() { $menu.css('display', ''); });
} else {
$menu.show().slideUp(250, function() { $menu.css('display', ''); });
}
});
// hide mobile menu beforeunload
$(window).bind('beforeunload unload', function() {
if ($mainMenuState[0].checked) {
$mainMenuState[0].click();
}
});
}
});
$(function() {
$('.nav-brand').click(function() {
$('#main-menu-state').click();
});
});
$(function() {
var $navBar = $('.main-nav');
var navPos = $navBar.offset().top;
$(window).scroll(function () {
var scrollPos = $(this).scrollTop();
if (scrollPos >= navPos) {
$navBar.addClass('fixed');
}
else {
$navBar.removeClass('fixed');
}
});
});
Thank you!