Nav bar animation - javascript

I want it so you click on something on the menu, the menu disappears and takes you to where you are leaded.
Here is the HTML doucument.
<!DOCTYPE html>
<html>
<head>
<link rel=stylesheet href="css.css" type="text/css" />
<link rel="icon" href="favicon.ico" type="image/icon"/>
<title></title>
</head>
<body>
<!-- start header -->
<header id="head">
<div class="something">
<nav id="menu">
<input type="checkbox" id="toggle-nav"/>
<label id="toggle-nav-label" for="toggle-nav"><i class="icon-reorder"></i></label>
<div class="box">
<ul>
<li><i class="icon-home"></i> Play</li>
<li><i class="icon-file-alt"></i> about</li>
<li><i class="icon-copy"></i> XXXXXX</li>
<li><i class="icon-envelope"></i> contacts</li>
</ul>
</div>
</nav>
</html>
And here is the css.
Thank you!

You have your styling for that menu overlay tied to the checkbox's checked property in the css. So when you click the checkbox, it changes some properties on the menu (z-index and opacity) to show it. In order for it to fall back to the default state of not showing the menu, you have to have that checkbox unchecked (if you want to use your css as-is). To do this, you can use Javascript. I used jQuery in the snippet below to set the checked property of your checkbox to false whenever you click on a link inside the menu, and magically your menu goes away! cheers!
(I should add that this solution would require jQuery 1.6 or newer. That's when prop was introduced. If that's an issue, there is great write up by user #Xian on modifying the checked property in different ways here: Setting "checked" for a checkbox with jQuery? )
$(function() {
$(".box a").on("click",function() {
$("#toggle-nav").prop('checked', false)
});
});
#import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css);
body {
font-family: 'Lato', sans-serif;
background: #353535;
color: #FFF;
}
#text {
color: #888;
}
.jumbotron h1 {
color: #353535;
}
/* under play */
footer {
margin-bottom: 0 !important;
margin-top: 80px;
}
footer p {
margin: 0;
padding: 0;
}
span.icon {
margin: 0 5px;
color: #D64541;
}
h2 {
color: #BDC3C7;
text-transform: uppercase;
letter-spacing: 1px;
}
.mrng-60-top {
margin-top: 60px;
}
a.animated-button:link, a.animated-button:visited {
position: relative;
display: block;
margin: 30px auto 0;
padding: 14px 15px;
color: #fff;
font-size:14px;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
letter-spacing: .08em;
border-radius: 0;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
a.animated-button.thar-one {
color: white;
cursor: pointer;
display: block;
position: relative;
width: 100%;
margin-left: 170%;
border: 2px solid white;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;
margin-bottom: 0 !important;
margin-top: 80px;
}
a.animated-button.thar-one:hover {
color: white !important;
background-color: black;
text-shadow: none;
}
a.animated-button.thar-one:hover:before {
bottom: 0%;
top: auto;
height: 100%;
margin: 0 auto;
}
a.animated-button.thar-one:before {
display: white;
position: absolute;
left: 0px;
top: 0px;
height: 0px;
width: 100%;
z-index: -1;
content: '';
color: black !important;
background: black;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;
}
#import url('http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css');
* { padding: 0px; margin: 0px; border: 0px; outline: 0px; } /* fast reset */
body {
font-family: 'Merriweather Sans', Arial, sans-serif;
font-size: 12px;
}
a { text-decoration: none; }
a:hover { text-decoration: underline; }
li { list-style: none; }
.something { margin: 0px 20% 0px 20%; }
#head { margin-top: 20px; }
#menu .box {
position: fixed;
text-align: center;
overflow: hidden;
z-index: -1;
opacity: 0;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
background: rgba(0,0,0,0.8);
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#menu ul {
position: relative;
top: 20%;
-webkit-transform: scale(2);
-moz-transform: scale(2);
-ms-transform: scale(2);
transform: scale(2);
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#menu li {
display: inline-block;
margin: 20px;
}
#menu li a {
border-radius: 3px;
padding: 15px;
border: 1px solid transparent;
text-decoration: none;
font-size: 18px;
color: #fff;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
#menu li a:hover { border-color: #fff; }
#menu li a i {
margin-right: 5px;
font-size: 24px;
}
/* Box */
#toggle-nav-label {
color: rgba(0,0,0,0.5);
background: white;
text-align: center;
line-height: 30px;
font-size: 16px;
display: block;
cursor: pointer;
position: relative;
z-index: 500;
width: 30px;
height: 30px;
border-radius: 10px;
}
#toggle-nav { display: none; }
#toggle-nav:checked ~ .box {
opacity: 1;
z-index: 400;
}
#toggle-nav:checked ~ .box ul {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#toggle-nav:checked ~ #toggle-nav-label {
background: #fff;
color: rgba(0,0,0,0.8);
}
#content { margin: 20px 0px 20px 0px; }
#content h1 {
margin-bottom: 20px;
font-size: 30px;
}
#content p {
font-size: 14px;
line-height: 150%;
margin-bottom: 20px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section>
<div>
<!-- start header -->
<header id="head">
<div class="something">
<nav id="menu">
<input type="checkbox" id="toggle-nav"/>
<label id="toggle-nav-label" for="toggle-nav"><i class="icon-reorder"></i></label>
<div class="box">
<ul>
<li><i class="icon-home"></i> Play</li>
<li><i class="icon-file-alt"></i> about</li>
<li><i class="icon-copy"></i> XXXXXX</li>
<li><i class="icon-envelope"></i> contacts</li>
</ul>
</div>
</nav>
</div>
</header>
<!-- end header -->
</div>
</section>
<!-- end content -->
<div class="jumbotron text-center">
<div class="container">
<h1>Das Krankenhuas</h1>
<p style="color:#888;">A game you will never escape</p>
</div>
</div>
<div class="container">
</div>
<div id="h1">
<center>
<h3> About The Game </h3>
</div>
<div id="text">
<center>
<p> "Daz Krankenhaus" is a text based adventure game set in WW2, you have been captured by the enemie and need to find your way out. <br> It is currently in developement, so its not a full game. It is 100% made in Html,Javascript and CSS. </p>
<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
</div>
<div id="h1">
<center>
<h3> Update log</h3>
</div>
<div id="text">
<center>
<p> Update 1: Where it all started.
<br> <br>
Update 2: Bunker hallways, bug fixes. timer for getting killed. office. important man. uniform. form. kill with gun.
<br> <br>
Update 3: fix search guard and some bugs. Interrgatoin room. </p>
<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
</div>
<a id="play"></a>
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-6"> Play </div>
</div>
</div>
<footer class="jumbotron text-center">
<div class="container">
<p style="color:#888">Copy righted 2good4you</p>
</div>
</footer>

Related

How to make CSS transition work using onclick

I am taking reference from :
https://codepen.io/SudhakarJ/pen/GRgpddL .
I want to make same transition effect in my application, where I have 10 images and I use 3 classes namely cars,animals and fruits and when I click they should be filtered.
But the animated filter selector is not performing transition
HTML
<div class="section">
<div id="wrapper-filter">
<ul id="filter-bar">
<span class="pill" style="color:#212121"></span>
<li class="filter-option option-1 active" onclick="filterSelection('all')" style="color:#fffefe">All</li>
<li class="filter-option option-2" onclick="filterSelection('cars')" style="color:#fffefe">Shoes</li>
<li class="filter-option option-3" onclick="filterSelection('animals')" style="color:#fffefe">Toys</li>
<li class="filter-option option-4" onclick="filterSelection('fruits')" style="color:#fffefe">Toys</li>
</ul>
</div>
css
body {background-color:#ffffff; margin: 0; padding:0; font-family: Tahoma;}
h2 {text-align:center;}
#filter-bar {width: 100%; margin:0; padding:0; height:36px; display:inline-flex;}
#wrapper-filter {background-color:#000; width: 570px; height:auto; margin:30px auto; border-radius: 30px; box-sizing: border-box;}
#filter-bar li {width: 190px;background-color: transparent; text-align: center; list-style-type: none;z-index:10; cursor: pointer; font-family: Open Sans, sans-serif; font-weight: 100; font-size: 15px;line-height:36px;}
.pill {position: absolute; width:190px; height: 38px; background-color: #39c; border-radius: 30px; color: #444; z-index:10; border: 5px solid #eee; box-sizing: border-box; }
.filter-option {transition: color 500ms;}
#filter-bar.option-1 .pill {margin-left: 0px; transition: margin-left 200ms ease;}
#filter-bar.option-2 .pill {margin-left: 187px; transition: margin-left 200ms ease;}
#filter-bar.option-3 .pill {margin-left: 380px; transition: margin-left 200ms ease;}
.option-1.active, .option-2.active, .option-3.active {color:#FFD700; transition: color 200ms; }
JS
$(document).ready(function() {
$("#filter-bar li").click(function() {
$("#filter-bar li").removeClass("active")
$(this).addClass("active")
$("#filter-bar").removeClass().addClass($(this).attr("data-target"))
})
})
Below is an adapted version of the codepen where:
menu width is changed from 570px to 760px to take in account the 4 elements instead of 3 (it could maybe done in a dynamic way to take in account any number of items)
item width is unchanged (190px)
onclick=filterSelection custom method is removed. JS retrieves the class to apply using the data-target-filter attr
CSS transitions rules are updated with your options (.all, .car, .animals, .fruits instead of example .option-1,.option-2,.option-3) so they match when the value is applied as a class on #bar-filter
$("#filter-bar li").click(function() {
$("#filter-bar li").removeClass("active");
$(this).addClass("active");
$("#filter-bar").removeClass().addClass($(this).attr("data-target-filter"));
});
#filter-bar {
width: 100%;
margin: 0;
padding: 0;
height: 36px;
display: inline-flex;
}
#wrapper-filter {
background-color: #000;
width: 760px;
height: auto;
margin: 30px auto;
border-radius: 30px;
box-sizing: border-box;
}
#filter-bar li {
width: 190px;
background-color: transparent;
text-align: center;
list-style-type: none;
z-index: 10;
cursor: pointer;
font-family: Open Sans, sans-serif;
font-weight: 100;
font-size: 15px;
line-height: 36px;
}
.pill {
position: absolute;
width: 190px;
height: 38px;
background-color: #39c;
border-radius: 30px;
color: #212121: z-index: 10;
border: 5px solid #eee;
box-sizing: border-box;
}
.filter-option {
transition: color 500ms;
color: #fffefe;
}
#filter-bar.all .pill {
margin-left: 0px;
transition: margin-left 200ms ease;
}
#filter-bar.cars .pill {
margin-left: 190px;
transition: margin-left 200ms ease;
}
#filter-bar.animals .pill {
margin-left: 380px;
transition: margin-left 200ms ease;
}
#filter-bar.fruits .pill {
margin-left: 570px;
transition: margin-left 200ms ease;
}
.all.active,
.cars.active,
.animals.active,
.fruits.active {
color: #FFD700;
transition: color 200ms;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="section">
<div id="wrapper-filter">
<ul id="filter-bar">
<span class="pill"></span>
<li class="filter-option all active" data-target-filter="all">All</li>
<li class="filter-option cars" data-target-filter="cars">Shoes</li>
<li class="filter-option animals" data-target-filter="animals">Toys</li>
<li class="filter-option fruits" data-target-filter="fruits">Fruits</li>
</ul>
</div>

How do i move sidebar-wrapper below horizontal bar

Hi I am giving a try as new am new to html and css can you guys suggest how can I move side wrapper below a horizontal nav bar and the nav bar should fit into page width. in horizontal nav bar I have text called home and logout can you guys move right end side and make it as homepage icon and logout icon
Fiddle :https://jsfiddle.net/xzm7bx4n/
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("active");
});
.row{
margin-left:0px;
margin-right:0px;
}
#wrapper {
padding-left: 70px;
transition: all .4s ease 0s;
height: 100%
}
#sidebar-wrapper {
margin-left: -150px;
left: 70px;
width: 200px;
background: #222;
position: fixed;
height: 60%;
z-index: 10000;
transition: all .4s ease 0s;
float:top;
}
.sidebar-nav {
display: block;
float: left;
width: 200px;
list-style: none;
margin: 0;
padding: 0;
}
#page-content-wrapper {
padding-left: 0;
margin-left: 0;
width: 100%;
height: auto;
}
#wrapper.active {
padding-left: 150px;
}
#wrapper.active #sidebar-wrapper {
left: 150px;
}
#page-content-wrapper {
width: 100%;
}
#sidebar_menu li a, .sidebar-nav li a {
color: #999;
display: block;
float: left;
text-decoration: none;
width: 200px;
background: #252525;
border-top: 1px solid #373737;
border-bottom: 1px solid #1A1A1A;
-webkit-transition: background .5s;
-moz-transition: background .5s;
-o-transition: background .5s;
-ms-transition: background .5s;
transition: background .5s;
}
.sidebar_name {
padding-top: 25px;
color: #fff;
opacity: .7;
}
.sidebar-nav li {
line-height: 40px;
text-indent: 20px;
}
.sidebar-nav li a {
color: #999999;
display: block;
text-decoration: none;
}
.sidebar-nav li a:hover {
color: #fff;
background: rgba(255,255,255,0.2);
text-decoration: none;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
line-height: 60px;
font-size: 18px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#main_icon
{
float:right;
padding-right: 65px;
padding-top:20px;
}
.sub_icon
{
float:right;
padding-right: 65px;
padding-top:10px;
}
.content-header {
height: 65px;
line-height: 65px;
}
.content-header h1 {
margin: 0;
margin-left: 20px;
line-height: 65px;
display: inline-block;
}
#media (max-width:767px) {
#wrapper {
padding-left: 70px;
transition: all .4s ease 0s;
}
#sidebar-wrapper {
left: 70px;
}
#wrapper.active {
padding-left: 150px;
}
#wrapper.active #sidebar-wrapper {
left: 150px;
width: 150px;
transition: all .4s ease 0s;
}
}
<script src="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.js"></script>
<script src="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/jquery/jquery.min.js"></script>
<link href="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.css" rel="stylesheet"/>
<link href="https://blackrockdigital.github.io/startbootstrap-sb-admin-2/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<div id="wrapper" class="active">
<!-- Sidebar -->
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav" id="sidebar">
<li><a>New Project</a></li>
<li><a>Projects</a></li>
<li><a>Pyramid Oppurtinities</a></li>
</ul>
</div>
<!-- Page content -->
<div id="page-content-wrapper">
<!-- Keep all page content within the page-content inset div! -->
<div class="page-content inset">
<div class="row">
<div class="col-md-14">
<p class="well lead">SANRIA Home Logout</p>
<div class="container">
<div class="row"> <!-- div da esquerda -->
<!-- Text input CNPJ e Razao Social-->
</div> <!-- fim div da esquerda -->
</div>
<!-- <p class="well lead">An Experiment using the sidebar (animeshmanglik.name)</p> -->
</div>
</div>
</div>
</div>
I'm glad you asked this question. When you have a header that should be the first thing in the DOM, you want to put this or as the first item inside the wrapper. The sidebar element can be placed below it to achieve a sleek look.
If you wanted a different style, we can discuss that as well.
This is the code I ended with.
<div id="wrapper" class="active">
<!-- Sidebar -->
<!-- Sidebar -->
<!-- Page content -->
<div id="page-content-wrapper">
<!-- Keep all page content within the page-content inset div! -->
<div class="page-content inset">
<div class="row">
<div class="col-md-14">
<p class="well lead">SANRIA Home Logout</p>
<div class="container">
<div class="row"> <!-- div da esquerda -->
<!-- Text input CNPJ e Razao Social-->
</div> <!-- fim div da esquerda -->
</div>
<!-- <p class="well lead">An Experiment using the sidebar (animeshmanglik.name)</p> -->
</div>
</div>
<div id="sidebar-wrapper">
<ul class="sidebar-nav" id="sidebar">
<li><a>New Project</a></li>
<li><a>Projects</a></li>
<li><a>Pyramid Oppurtinities</a></li>
</ul>
</div>
</div>
</div>
Here is CSS.
.row{
margin-left:0px;
margin-right:0px;
}
#wrapper {
/*padding-left: 70px;*/
transition: all .4s ease 0s;
height: 100%
}
#sidebar-wrapper {
margin-left: -150px;
left: 70px;
width: 200px;
background: #222;
position: fixed;
height: 60%;
z-index: 10000;
transition: all .4s ease 0s;
/*float:top;*/
}
.sidebar-nav {
display: block;
float: left;
width: 200px;
list-style: none;
margin: 0;
padding: 0;
}
#page-content-wrapper {
padding-left: 0;
margin-left: 0;
width: 100%;
height: auto;
}
#wrapper.active {
/*padding-left: 150px;*/
}
#wrapper.active #sidebar-wrapper {
left: 150px;
}
#page-content-wrapper {
width: 100%;
}
#sidebar_menu li a, .sidebar-nav li a {
color: #999;
display: block;
float: left;
text-decoration: none;
width: 200px;
background: #252525;
border-top: 1px solid #373737;
border-bottom: 1px solid #1A1A1A;
-webkit-transition: background .5s;
-moz-transition: background .5s;
-o-transition: background .5s;
-ms-transition: background .5s;
transition: background .5s;
}
.sidebar_name {
padding-top: 25px;
color: #fff;
opacity: .7;
}
.sidebar-nav li {
line-height: 40px;
text-indent: 20px;
}
.sidebar-nav li a {
color: #999999;
display: block;
text-decoration: none;
}
.sidebar-nav li a:hover {
color: #fff;
background: rgba(255,255,255,0.2);
text-decoration: none;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
line-height: 60px;
font-size: 18px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#main_icon
{
float:right;
padding-right: 65px;
padding-top:20px;
}
.sub_icon
{
float:right;
padding-right: 65px;
padding-top:10px;
}
.content-header {
height: 65px;
line-height: 65px;
}
.content-header h1 {
margin: 0;
margin-left: 20px;
line-height: 65px;
display: inline-block;
}
#media (max-width:767px) {
#wrapper {
/*padding-left: 70px;*/
transition: all .4s ease 0s;
}
#sidebar-wrapper {
left: 70px;
}
#wrapper.active {
/*padding-left: 150px;*/
}
#wrapper.active #sidebar-wrapper {
left: 150px;
width: 150px;
transition: all .4s ease 0s;
}
}
.well{
margin-bottom: 0px;
}
.lead{
margin-bottom: 0px;
}
p{
margin: 0px;
}
Working JSFiddle: https://jsfiddle.net/eq6bhyg5/
Notes: I took out all of the unnecessary padding that seemed to be throwing off the view.
We really should use the space that we are given.
If you want the sidebar to be in the side, with the page including header next to it, adjacent.
Action: Take the sidebar back out of the page-content-wrapper.
add display:inline-block; width:20% to side-bar css. Then set the wrapper css to width: 80%; display: inline-block;

lock and unlock according to a condition

In this website : website
code involved :
/* CSS Document */
/* Float Elements
---------------------------------*/
.fl-lt {
float: left;
}
.fl-rt {
float: right;
}
/* Clear Floated Elements
---------------------------------*/
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
.clearfix:before,
.clearfix:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
.clearfix:after {
clear: both;
}
.figure {
margin: 0px;
}
img {
max-width: 100%;
}
a,
a:hover,
a:active {
outline: 0px !important
}
#font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.1.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
/* Primary Styles
---------------------------------*/
body {
background: #fff;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
font-weight: normal;
color: #888888;
margin: 0;
}
h2 {
font-size: 34px;
color: #222222;
font-family: 'Montserrat', sans-serif;
font-weight: 700;
letter-spacing: -1px;
margin: 0 0 15px 0;
text-align: center;
text-transform: uppercase;
}
h3 {
font-family: 'Montserrat', sans-serif;
color: #222222;
font-size: 16px;
margin: 0 0 5px 0;
text-transform: uppercase;
font-weight: 400;
}
h6 {
font-size: 16px;
color: #888888;
font-family: 'Open Sans', sans-serif;
font-weight: 400;
text-align: center;
margin: 0 0 60px 0;
}
p {
line-height: 24px;
margin: 0;
}
/* Header Styles
---------------------------------*/
.header {
text-align: center;
background: url(../img/pw_maze_black_2X.png) left top repeat;
padding: 280px 0;
}
.logo {
width: 130px;
margin: 0 auto 35px;
}
.header h1 {
font-family: 'Montserrat', sans-serif;
font-size: 50px;
font-weight: 400;
letter-spacing: -1px;
margin: 0 0 22px 0;
color: #fff;
}
.we-create {
padding: 0;
margin: 35px 0 55px;
}
.wp-pic {
margin-bottom: 20px;
}
.we-create li {
display: inline-block;
font-family: 'Montserrat', sans-serif;
font-size: 14px;
color: #bcbcbc;
text-transform: uppercase;
font-weight: 400;
margin: 0 5px 0 0;
padding: 0 0 0 15px;
}
.we-create li:first-child {
background: none;
}
.start-button {
padding-left: 0px;
}
.start-button li a {
color: #fff;
}
.link {
padding: 15px 35px;
background: #7cc576;
color: #fff !important;
font-size: 16px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
display: inline-block;
border-radius: 3px;
text-transform: uppercase;
line-height: 25px;
margin-bottom: 20px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
.link:hover {
text-decoration: none;
color: #7cc576 !important;
background: #fff;
}
.link:active,
.link:focus {
background: #7cc576;
text-decoration: none;
color: #fff !important;
}
/* Navigation
---------------------------------*/
.main-nav-outer {
padding: 0px;
border-bottom: 1px solid #dddddd;
box-shadow: 0 4px 5px -3px #ececec;
position: relative;
background: #fff;
}
.main-nav {
text-align: center;
margin: 10px 0 0px;
padding: 0;
list-style: none;
}
.main-nav li {
display: inline;
margin: 0 1px;
}
.main-nav li a {
display: inline-block;
color: #222222;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
text-decoration: none;
line-height: 20px;
margin: 17px 32px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
.main-nav li a:hover {
text-decoration: none;
color: #7cc576;
}
.small-logo {
padding: 0 32px;
}
.main-section {
padding: 90px 0 110px;
}
/* Portfolio
---------------------------------*/
.Portfolio-nav {
padding: 0;
margin: 0 0 45px 0;
list-style: none;
text-align: center;
}
.Portfolio-nav li {
margin: 0 10px;
display: inline;
}
.Portfolio-nav li a {
display: inline-block;
padding: 10px 22px;
font-size: 12px;
line-height: 20px;
color: #222222;
border-radius: 4px;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
background: #f7f7f7;
margin-bottom: 5px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
.Portfolio-nav li a:hover {
background: #7cc576;
color: #fff;
text-decoration: none;
}
.portfolioContainer {
margin: 0 auto;
padding-left: 15px;
}
.Portfolio-box {
text-align: center;
margin-bottom: 30px;
height: 350px;
width: 350px;
overflow: hidden;
float: left;
padding: 0;
}
.Portfolio-box img {
margin-bottom: 25px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
.Portfolio-box img:hover {
opacity: 0.6;
}
.Portfolio-nav li a.current {
background: #7cc576;
color: #fff;
text-decoration: none;
}
img {
max-width: 100%;
}
/* no transition on .isotope container */
.isotope .isotope-item {
/* change duration value to whatever you like */
-webkit-transition-duration: 0.6s;
-moz-transition-duration: 0.6s;
transition-duration: 0.6s;
}
.isotope .isotope-item {
-webkit-transition-property: -webkit-transform, opacity;
-moz-transition-property: -moz-transform, opacity;
transition-property: transform, opacity;
}
.main-section.paddind {
padding-bottom: 60px;
}
/* Clients
---------------------------------*/
.client-part {
background: url(../img/section-bg1.jpg) center center no-repeat;
background-size: cover;
padding: 55px 0;
text-align: center;
}
.client-part-haead {
color: #fdfdfd;
font-size: 28px;
line-height: 41px;
margin: 30px 0 10px;
font-family: ''Open Sans',sans-serif';
font-style: italic;
}
.client {
padding: 0;
margin: 20px 0 0;
list-style: none;
text-align: center;
}
.client li {
display: inline;
margin: 0 15px;
}
.client li a {
display: inline-block;
}
.client li a img {
margin-bottom: 15px;
border-radius: 50%;
}
.client li a:hover {
text-decoration: none;
}
.client li a h3 {
color: #ffffff;
}
.client li a span {
color: #f1f1f1;
}
.quote-right {
font-style: normal;
width: 68px;
height: 68px;
margin: 0 auto;
border: 2px solid #7cc576;
border-radius: 50%;
display: block;
line-height: 68px;
text-align: center;
font-size: 27px;
color: #7cc576;
cursor: pointer;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
.quote-right:hover {
color: #fff;
border: 2px solid #fff;
}
.c-logo-part {
background: #7cc576;
padding: 25px 0;
filter: alpha(opacity=60);
}
.c-logo-part ul {
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}
.c-logo-part ul li {
display: inline;
margin: 0 25px;
}
.c-logo-part ul a {
display: inline-block;
margin: 0 20px;
}
.main-section.team {
padding: 85px 0;
}
.main-section.team h6 {
margin-bottom: 40px;
}
.portfolioContainer {
max-width: 1140px;
}
/* Animation Timers
---------------------------------*/
.delay-02s {
animation-delay: 0.2s;
-webkit-animation-delay: 0.2s;
}
.delay-03s {
animation-delay: 0.3s;
-webkit-animation-delay: 0.3s;
}
.delay-04s {
animation-delay: 0.4s;
-webkit-animation-delay: 0.4s;
}
.delay-05s {
animation-delay: 0.5s;
-webkit-animation-delay: 0.5s;
}
.delay-06s {
animation-delay: 0.6s;
-webkit-animation-delay: 0.6s;
}
.delay-07s {
animation-delay: 0.7s;
-webkit-animation-delay: 0.7s;
}
.delay-08s {
animation-delay: 0.8s;
-webkit-animation-delay: 0.8s;
}
.delay-09s {
animation-delay: 0.9s;
-webkit-animation-delay: 0.9s;
}
.delay-1s {
animation-delay: 1s;
-webkit-animation-delay: 1s;
}
.delay-12s {
animation-delay: 1.2s;
-webkit-animation-delay: 1.2s;
}
span.fa-stack.fa-5x.has-badge {
width: 180px;
height: 180px;
}
#unlocked li:before {
content: '\2713';
display: inline-block;
color: green;
margin-left: -65px;
padding: 0 9px 0 0;
}
#unlocked li {
list-style-type: none;
font-size: 1.5em;
margin: 1px;
font-weight: bold;
}
#locked li:before {
content: '\274c';
display: inline-block;
color: red;
margin-left: -65px;
padding: 0 9px 0 0;
}
#locked li {
list-style-type: none;
font-size: 1.5em;
margin: 1px;
font-weight: bold;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, maximum-scale=1">
<title>Homepage</title>
<link rel="icon" href="favicon.png" type="image/png">
<link rel="shortcut icon" href="favicon.ico" type="img/x-icon">
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,800italic,700italic,600italic,400italic,300italic,800,700,600' rel='stylesheet' type='text/css'>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/font-awesome.css" rel="stylesheet" type="text/css">
<link href="css/responsive.css" rel="stylesheet" type="text/css">
<link href="css/animate.css" rel="stylesheet" type="text/css">
<!--[if IE]><style type="text/css">.pie {behavior:url(PIE.htc);}</style><![endif]-->
<script type="text/javascript" src="js/jquery.1.8.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/jquery-scrolltofixed.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.isotope.js"></script>
<script type="text/javascript" src="js/wow.js"></script>
<script type="text/javascript" src="js/classie.js"></script>
<script src="contactform/contactform.js"></script>
<link rel="stylesheet" href="css/stylebadge.css">
</head>
<body>
<header class="header" id="header">
<!--header-start-->
<div class="container">
<figure class="logo animated fadeInDown delay-07s">
<a href="#">
<img src="img/logo.png" alt="">
</a>
</figure>
<h1 class="animated fadeInDown delay-07s">Welcome To Knight Studios</h1>
<ul class="we-create animated fadeInUp delay-1s">
<li>We are a digital agency that loves crafting beautiful websites.</li>
</ul>
<a class="link animated fadeInUp delay-1s" href="#">Get Started</a>
</div>
</header>
<!--header-end-->
<nav class="main-nav-outer" id="test">
<!--main-nav-start-->
<div class="container">
<ul class="main-nav">
<li>Home
</li>
<li>Services
</li>
<li>Badges
</li>
<li class="small-logo">
<a href="#header">
<img src="img/small-logo.png" alt="">
</a>
</li>
<li>Clients
</li>
<li>Team
</li>
<li>Contact
</li>
</ul>
<a class="res-nav_click" href="#"><i class="fa-bars"></i></a>
</div>
</nav>
<!--main-nav-end-->
<section class="main-section paddind" id="Portfolio">
<!--main-section-start-->
<div class="container">
<h2>Badges</h2>
<h6></h6>
<div class="portfolioFilter">
<ul class="Portfolio-nav wow fadeIn delay-02s">
<li>All Badges
</li>
<li>Salesforce
</li>
<li>L & TD
</li>
</ul>
</div>
</div>
<div class="portfolioContainer wow fadeInUp delay-04s">
<div class=" Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=10>
<div class="badgesize">
<img src="img/66.png" alt="">
</div>
</span>
<h3>Completionist</h3>
<p>Didnot submit timesheet for a week</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class="Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=15>
<div class="badgesize">
<img src="img/11.png" alt="">
</div>
</span>
<h3>Get A LIFE</h3>
<p>Logged greater than 60 hours for the week</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=2>
<div class="badgesize">
<img src="img/22.png" alt="">
</div>
</span>
<h3>Slogger</h3>
<p>Logged greater than 55 hours for the week</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=100>
<div class="badgesize">
<img src="img/1.png" alt="">
</div>
</span>
<h3>Into The Game</h3>
<p>Starts Playing the Game</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=100>
<div class="badgesize">
<img src="img/2.png" alt="">
</div>
</span>
<h3>Hipster</h3>
<p>Branding</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box branding">
<span class="fa-stack fa-5x has-badge" data-count=20>
<div class="badgesize">
<img src="img/7.png" alt=""></a>
</div>
</span>
<h3>Windmills</h3>
<p>Photography</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box photography">
<span class="fa-stack fa-5x has-badge" data-count=0>
<div class="badgesize">
<img src="img/ltd1.png" alt=""></a>
</div>
</span>
<h3>Windmills</h3>
<p>Photography</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
<div class=" Portfolio-box photography">
<span class="fa-stack fa-5x has-badge" data-count=200>
<div class="badgesize">
<img src="img/ltd2.png" alt=""></a>
</div>
</span>
<h3>Windmills</h3>
<p>Photography</p>
<ul id="unlocked">
<li>UNLOCKED</li>
</ul>
<ul id="locked">
<li>LOCKED</li>
</ul>
</div>
</div>
</section>
<!--main-section-end-->
<section class="business-talking">
<!--business-talking-start-->
<div class="container">
<h2>Let’s Talk Business.</h2>
</div>
</section>
<!--business-talking-end-->
<script type="text/javascript">
$(document).ready(function(e) {
$('#test').scrollToFixed();
$('.res-nav_click').click(function() {
$('.main-nav').slideToggle();
return false
});
});
</script>
<script>
wow = new WOW({
animateClass: 'animated',
offset: 100
});
wow.init();
</script>
<script type="text/javascript">
$(window).load(function() {
$('.main-nav li a').bind('click', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top - 102
}, 1500, 'easeInOutExpo');
/*
if you don't want to use the easing effects:
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1000);
*/
event.preventDefault();
});
})
</script>
<script type="text/javascript">
$(window).load(function() {
var $container = $('.portfolioContainer'),
$body = $('body'),
colW = 375,
columns = null;
$container.isotope({
// disable window resizing
resizable: true,
masonry: {
columnWidth: colW
}
});
$(window).smartresize(function() {
// check if columns has changed
var currentColumns = Math.floor(($body.width() - 30) / colW);
if (currentColumns !== columns) {
// set new column count
columns = currentColumns;
// apply width to container manually, then trigger relayout
$container.width(columns * colW)
.isotope('reLayout');
}
}).smartresize(); // trigger resize to set container width
$('.portfolioFilter a').click(function() {
$('.portfolioFilter .current').removeClass('current');
$(this).addClass('current');
var selector = $(this).attr('data-filter');
$container.isotope({
filter: selector,
});
return false;
});
});
</script>
</body>
</html>
I have two conditions for badges :(below are the two badges)
Issue :
when the count (which appears on the upper right side of the badge as "10" and "0" here) is greater than "0" then "unlocked with check mark" should be displayed else "locked with cross" should be dispalyed and it should be faded as in hover effect we see normally.
Its quite tricky for me.Kindly help,if anyone can.Thanks a lot.God bless.
You could iterate all Portfolio-box, check when they have a span badge with data-count > 0, then show/hide the locked/unlocked
$.each($('.Portfolio-box'), function() {
var count = $(this).children('has-badge').attr('data-count');
if(count > 0) {
$(this).children('ul.locked').hide();
$(this).children('ul.unlocked').show();
} else {
$(this).children('ul.locked').show();
$(this).children('ul.unlocked').hide();
}
});
And in your html replace
<ul id="unlocked">
<ul id="locked">
For
<ul class="unlocked">
<ul class="locked">
Another option you could do is to use PHP to not generate the HTML for locked/unlocked based on your business rule, something like:
<?php if($badgeCount >0): ?>
<ul class="unlocked">
....
</ul>
<? else: ?>
<ul class="locked">
....
</ul>
<? endif; ?>

Transform: TranslateY with Javascript

So i know this is so easy for most of people here but i'm learning and i realy hope someone can help me;
I'm making a responsive nav for my website so i want to click the menu buttom so the menu drops from top of the screen. So i did the transform: translateY(-100%), but i have a function to make my menu (classic 3 lines) to turn into an "X" so what can i add to this function to make at the same time the menu appears?. And i don't know why but the transition from 3 hirizontal lines to X works nice but from X to the 3 lines is not working the same way.
DOM
<div id="mobile_menu">
<div class="mobile_menu_lines1"></div>
<div class="mobile_menu_lines2"></div>
<div class="mobile_menu_lines3"></div>
</div>
<nav id="mobile_nav">
<ul id="mobile_links">
<li>INICIO</li>
<li>PORTAFOLIO</li>
<li>NOSOTROS</li>
<li>CONTACTO</li>
</ul>
<ul id="mobile_links_social">
<li><img src="assets/img/svgs/facebook_icon.svg" alt="Facebook logo"/></li>
<li><img src="assets/img/svgs/twitter_icon.svg" alt="Twitter Logo"/></li>
<li><img src="assets/img/svgs/instagram_icon.svg" alt="Instagram logo"/></li>
</ul>
</nav>
CSS
#mobile_menu{
position: absolute;
display: block;
width: 50px;
height: 60px;
float: right;
right: 5px;
cursor: pointer;
transition: all 0.3s ease-in-out;
}
.mobile_menu_lines1{
max-width: 70%;
align-items: center;
height: 2px;
background-color: white;
margin-top: 18px;
border-radius: 2px;
}
.mobile_menu_lines2, .mobile_menu_lines3{
max-width: 70%;
align-items: center;
height: 2px;
background-color: white;
margin-top: 9px;
border-radius: 2px;
}
.show .mobile_menu_lines1 {
transform: rotate(45deg) translate(11px, 5px);
transition: all 0.3s ease-in-out;
}
.show .mobile_menu_lines2 {
opacity: 0;
transition: all 0.3s ease-in-out;
}
.show .mobile_menu_lines3 {
transform: rotate(-45deg) translate(10px, -5px);
transition: all 0.3s ease-in-out;
}
#mobile_nav{
display: block;
text-align: center;
padding-top:60px;
background-color: rgba(0, 0, 0, 0.7);
width: 100%;
transform: translateY(-100%);
transition: all 0.3s ease-in-out;
}
#mobile_nav #mobile_links li{
padding: 15px 0;
}
#mobile_nav #mobile_links li a{
list-style: none;
text-decoration: none;
color: white;
font-family: "josefin sans";
font-size: 12px;
letter-spacing: 7px;
align-items: center;
text-align: center;
padding: 15px 0;
width:600px;
max-width: 100%
}
#mobile_nav #mobile_links_social li{
padding: 10px 20px;
}
JS
var mobileNavMostrar = document.getElementById('mobile_menu');
mobileNavMostrar.addEventListener('click',function(){
mobileNavMostrar.classList.toggle('show');
})
Thanks in advance.
I tried your code and I think you are missing two things - the css to define how the mobile_nav should change when it is shown, and the javascript to apply that css on click.

Changing CSS panel to 100% width creates jumpy jQuery scroll

I'm trying to link the nav bar list items to transition a scroll to specific panels on the page. After making adjustment to the CSS to make all panel backgrounds (.maincontent) 100% page width the scroll effect no longer works...
CSS:
/****Landscape****/
/*global styles*/
.body {
width: 100%;
margin: 0;
list-style: none;
text-decoration: none;
font-size: 1.05em;
font-family: Helvetica Neue, Helvetica, Arial, Sans-serif;
}
a {
appearance: none;
font-size: 1.05em;
font-family: Helvetica Neue, Helvetica, Arial, Sans-serif;
background: transparent;
color: #000000;
border: none;
letter-spacing: 0.15em;
text-transform: uppercase;
transition: color 0.5s ease;
list-style: none;
text-decoration: none;
}
a:focus,
a:hover {
color: #e6e8eb;
cursor: pointer;
transition: color 0.5s ease;
width: inherit;
right: 0;
left: 0;
}
a:active {
color: #484747;
}
/*----/----global styles*/
/*Maincontent*/
.maincontent {
position: absolute;
top: 0;
left: 0;
width: 100%;
font-size: 1.05em;
font-family: Helvetica Neue, Helvetica, Arial, Sans-serif;
}
/*----/----Maincontent*/
/*contact panel*/
.letmeknow:hover {
color: #464c4c;
cursor: pointer;
transition: color 0.5s ease;
}
.letmeknow {
appearance: none;
width: 80%;
height: 50px;
font-size: 1.05em;
background: transparent;
color: #e6e8eb;
border: none;
letter-spacing: 0.15em;
text-transform: uppercase;
transition: color 0.5s ease;
outline: none;
border: none;
}
/*Contact submit Form*/
#container {
width: 840px;
margin: 25px auto;
}
.whysign {
float: left;
background-color: white;
width: 480px;
height: 347px;
border-radius: 0 5px 5px 0;
padding-top: 20px;
padding-right: 20px;
}
.signup {
float: left;
width: 300px;
padding: 30px 20px;
background-color: white;
text-align: center;
border-radius: 5px 0 0 5px;
}
[type=text] {
display: block;
margin: 0 auto;
width: 80%;
border: 0;
border-bottom: 1px solid rgba(0, 0, 0, .2);
height: 45px;
line-height: 45px;
margin-bottom: 10px;
font-size: 1em;
color: rgba(0, 0, 0, .4);
}
input[type="submit"] {
appearance: none;
width: 80%;
height: 50px;
font-size: 1.05em;
background: transparent;
color: #e6e8eb;
border: none;
letter-spacing: 0.15em;
text-transform: uppercase;
transition: color 0.5s ease;
outline: none;
border: none;
}
input[type="submit"]:hover {
color: #464c4c;
cursor: pointer;
transition: color 0.5s ease;
}
[type='text']:focus {
outline: none;
border-color: #53CACE;
}
span:hover {
color: #53CACE;
}
/*----/----contact form*/
/*Nav Bar*/
.header {
background: #ffffff;
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99999;
}
.nav {
background: #ffffff;
float: right;
text-align: right;
}
.nav > li {
display: inline-block;
padding: 2px;
padding-right: 30px;
}
/*----/----Nav Bar*/
/*Panels*/
.panel {
width: 100%;
background: #000000;
color: #ffffff;
height: 40em;
padding: 3em;
}
.links {
color: #ffffff;
}
.panel .inner {
padding-top: 10%;
color: #df
}
.panel.panel-blank {
background: #ffffff;
color: #000000;
}
/*----/----Panels*/
/*logo*/
.logo {
float: left;
display: inline-block;
width: 15px;
height: 15px;
padding: 18px;
cursor: pointer;
}
/*----/----logo*/
/****Portrait****/
#media (max-width: 850px) {
/*global styles*/
.body {
width: 100%;
margin: 0;
list-style: none;
text-decoration: none;
}
.header {
background: #ffffff;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
.nav {
position: fixed;
width: 100%;
text-align: center;
display: none;
background-color: #ffffff;
left: 0;
top: 39px;
}
.nav > li {
postition: absolute;
display: block;
left: 0;
width: 100%;
padding-top: 0.6em;
padding-bottom: 1em;
}
.nav > li:hover {
postition: absolute;
display: block;
left: 0;
width: 100%;
padding-top: 0.6em;
padding-bottom: 1em;
cursor: pointer;
}
/*----/----global styles*/
/*logo*/
.logo {
float: left;
display: block;
width: 15px;
height: 15px;
padding: 18px;
cursor: pointer;
}
/*----/----logo*/
/*navigation icon*/
#toggle-menu {
float: right;
display: block;
width: 15px;
height: 15px;
padding: 20px;
}
#toggle-menu div {
width: 15px;
height: 15px;
position: relative;
}
#toggle-menu span {
display: block;
width: 15px;
height: 3px;
background: black;
position: absolute;
-webkit-transition: -webkit-transform 0.2s ease-in-out, top 0.2s ease-in-out 0.2s, opacity 0.2s ease-in-out 0.2s;
-moz-transition: -moz-transform 0.2s ease-in-out, top 0.2s ease-in-out 0.2s, opacity 0.2s ease-in-out 0.2s;
transition: transform 0.2s ease-in-out, top 0.2s ease-in-out 0.2s, opacity 0.2s ease-in-out 0.2s;
-webkit-transform-origin: center;
-moz-transform-origin: center;
transform-origin: center;
}
#toggle-menu span.top {
top: 0px;
}
#toggle-menu span.middle {
top: 6px;
}
#toggle-menu span.bottom {
top: 12px;
}
/*----/----navigation icon*/
/*navigation icon animation*/
#toggle-menu.menu-is-active span {
-webkit-transition: -webkit-transform 0.2s ease-in-out 0.2s, top 0.2s ease-in-out, opacity 0.2s ease-in-out;
-moz-transition: -moz-transform 0.2s ease-in-out 0.2s, top 0.2s ease-in-out, opacity 0.2s ease-in-out;
transition: transform 0.2s ease-in-out 0.2s, top 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
#toggle-menu.menu-is-active span.top,
#toggle-menu.menu-is-active span.middle {
top: 6px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
}
#toggle-menu.menu-is-active span.middle {
opacity: 0;
}
#toggle-menu.menu-is-active span.bottom {
top: 6px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg);
}
/*----/----navigation icon animation*/
}
/*----/----Portrait*/
jQuery:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
jQuery(document).ready(function () {
$(window).resize(function(){
if ($(window).width() >=850) {
$(".nav").show();
}
else{ $(".nav").hide();}
});
$('#toggle-menu').click(function () {
$(this).toggleClass('menu-is-active')
});
/* click outside of nav to trigger navigation icon animation*/
$(document).click(function () {
$("#toggle-menu").removeClass();
});
$("nav").click(function (e) {
e.stopPropagation();
return false;
});
/*----/----navigation icon animation*/
/*toggle menu*/
jQuery("#toggle-menu").click(function () {
jQuery(".nav").slideToggle();
});
/* click outside of nav to close toggle*/
$(document).click(function () {
if ($(window).width() < 850) {
$(".nav").hide();
} else {
$(".nav").show();
}
});
$("#toggle-menu").click(function (e) {
e.stopPropagation();
return false;
});
/*----/----toggle menu*/
/*Jump Scroll*/
$(function() {
var $window = $(window), $document = $(document),
transitionSupported = typeof document.body.style.transitionProperty === "string", // detect CSS transition support
scrollTime = 1; // scroll time in seconds
$(document).on("click", "a[href*=#]:not([href=#])", function(e) {
var target, avail, scroll, deltaScroll;
if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
target = $(this.hash);
target = target.length ? target : $("[id=" + this.hash.slice(1) + "]");
if (target.length) {
avail = $document.height() - $window.height();
if (avail > 0) {
scroll = target.offset().top;
if (scroll > avail) {
scroll = avail;
}
} else {
scroll = 0;
}
deltaScroll = $window.scrollTop() - scroll;
// if we don't have to scroll because we're already at the right scrolling level,
if (!deltaScroll) {
return; // do nothing
}
e.preventDefault();
if (transitionSupported) {
$("html").css({
"margin-top": deltaScroll + "px",
"transition": scrollTime + "s ease-in-out"
}).data("transitioning", scroll);
} else {
$("html, body").stop(true, true) // stop potential other jQuery animation (assuming we're the only one doing it)
.animate({
scrollTop: scroll + "px"
}, scrollTime * 1000);
return;
}
}
}
});
if (transitionSupported) {
$("html").on("transitionend webkitTransitionEnd msTransitionEnd oTransitionEnd", function(e) {
var $this = $(this),
scroll = $this.data("transitioning");
if (e.target === e.currentTarget && scroll) {
$this.removeAttr("style").removeData("transitioning");
$("html, body").scrollTop(scroll);
}
});
}
});
/*----/----Jump Scroll*/
/*contact let me know toggle*/
jQuery(".letmeknow").click(function () {
jQuery(".container").slideToggle();
});
/*----/-----contact let me know toggle*/
});
HTML:
<div class="header">
<div class="navbar">
LogoPlaceHolder
<a id="toggle-menu">
<div>
<span class="top"></span>
<span class="middle"></span>
<span class="bottom"></span>
</div>
</a>
<ul class="nav">
<li>Home</li>
<li>About</li>
<li>Work</li>
<li>Contact</li>
</ul>
</div>
</div>
<div class="maincontent">
<div class="panel multiplepanels" id="panel1">
<div class="inner"> 1 </div>
</div>
<div class="panel panel-blank multiplepanels" id="panel2">
<div class="inner">
<p>Work Title 1</p> View Project → </div>
</div>
<div class="panel multiplepanels" id="panel3">
<div class="inner">
<p>Work Title 2</p> View Project → </div>
</div>
<div class="panel panel-blank multiplepanels" id="panel4">
<div class="inner">
<p>Work Title 3</p> View Project → </div>
</div>
<div class="panel multiplepanels" id="panel5">
<div class="inner">
<p>Work Title 4</p> View Project → </div>
</div>
<div class="panel panel-blank multiplepanels" id="panel6">
<div class="inner">
<p>Work Title 5</p> View Project → </div>
</div>
<div class="panel multiplepanels" id="panel7">
<div class="inner">
<p>Work Title 6</p> View Project → </div>
</div>
<div class="panel panel-blank multiplepanels" id="panel8">
<div class="inner">
<P>Like what I do?</P>
<p>Let me know</p>
<div id='container'>
<div class='signup'>
<p> Send me a message </p>
<form>
<input type='text' placeholder='First:' />
<input type='text' placeholder='Last:' />
<input type='text' placeholder='Email:' />
<input type='text' placeholder='Phone:' />
<input type='submit' placeholder='SUBMIT' />
</form>
</div>
</div>
<div class="thank you">
<p>Thank you for your message!</p>
</div>
</div>
</div>
<div class="panel multiplepanels" id="panel9">
<div class="inner">
<p>Social</p>
</div>
</div>
</div>
<footer>
<div class="panel panel-blank" id="panel10">
<div class="inner"> © 2015 thiswebsite.com</div>
</div>
</footer>
It is caused by giving .maincontent absolute positioning. This makes html not be the full height of the document. And the script relies on this for the transition. So here are a few changes to make :
Demo
Take a way the dot from body (sidenote) :
.body {
...
}
Remove positioning here :
.maincontent {
width: 100%;
font-size: 1.05em;
font-family: Helvetica Neue, Helvetica, Arial, Sans-serif;
}
And then box-sizing on this element to remove the horizontal scrollbar :
.panel {
width: 100%;
background: #000000;
color: #ffffff;
height: 40em;
padding: 3em;
box-sizing: border-box;
}

Categories

Resources