Responsive navigation box
up vote
1
down vote
favorite
I made a navigation bar with CSS animation and javascript. But I could not make it responsive. I want the navigation bar animation to be none when the window is resized less than 700px and the animation should appear if it is greater than 700px.That means the transform
property of three-d-box :hover
on css paart must be hidden when window is resized to 700px.The navigation bar code is below;
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
javascript css navigationbar
add a comment |
up vote
1
down vote
favorite
I made a navigation bar with CSS animation and javascript. But I could not make it responsive. I want the navigation bar animation to be none when the window is resized less than 700px and the animation should appear if it is greater than 700px.That means the transform
property of three-d-box :hover
on css paart must be hidden when window is resized to 700px.The navigation bar code is below;
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
javascript css navigationbar
1
You could just use a media query. Something like@media (min-width: 700px)
and put there your.three-d:hover .three-d-box
animation if you don't want to use it below that screen width.
– ReSedano
Nov 10 at 14:26
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I made a navigation bar with CSS animation and javascript. But I could not make it responsive. I want the navigation bar animation to be none when the window is resized less than 700px and the animation should appear if it is greater than 700px.That means the transform
property of three-d-box :hover
on css paart must be hidden when window is resized to 700px.The navigation bar code is below;
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
javascript css navigationbar
I made a navigation bar with CSS animation and javascript. But I could not make it responsive. I want the navigation bar animation to be none when the window is resized less than 700px and the animation should appear if it is greater than 700px.That means the transform
property of three-d-box :hover
on css paart must be hidden when window is resized to 700px.The navigation bar code is below;
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
$('.block-menu').find('a').each(function()
var el = $(this),
elText = el.text();
el.addClass("three-d");
el.append('<span aria-hidden="true" class="three-d-box"><span class="front">'+elText+'</span><span class="back">'+elText+'</span></span>');
);
.container
width: match-parent;
padding: 12px ;
display: flex;
align-items: center;
justify-content: center;
a
color: #fc0;
text-decoration:none;
.block-menu
width:fit-content;
height:fit-content;
.block-menu li
display: inline-block;
.block-menu li a
color: #fff;
display: block;
text-decoration: none;
font-family: 'Passion One', Arial, sans-serif;
font-smoothing: antialiased;
text-transform: uppercase;
font-family: 'Righteous', cursive;
overflow: visible;
width:fit-content;
height: fit-content;
font-size: 1.6vw;
padding: 15px 10px;
margin-left:auto;
margin-right:auto;
margin-top:1px;
margin-bottom:1px;
.three-d
perspective: 200px;
transition: all .07s linear;
position: relative;
cursor: pointer;
.three-d:hover .three-d-box,
.three-d:focus .three-d-box
transform: translateZ(-25px) rotateX(90deg);
.three-d-box
transition: all 0.3s ease-out;
transform: translatez(-25px);
transform-style: preserve-3d;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
.front
transform: rotatex(0deg) translatez(25px);
.back
transform: rotatex(-90deg) translatez(25px);
color: #ffe7c4;
.front, .back
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius:15%;
background: black;
padding: 15px 10px;
color: white;
pointer-events: none;
box-sizing: border-box;
.back
background: #d05ce8;
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<div id="navbox">
<div class="container" id="navbar">
<ul class="block-menu"><b>
<li ><a href="gifts.html">Gifts Corner</a></li>
<li ><a href="activity.html">Our activities</a></li>
<li ><a href="inspire.html">Inspiration</a></li>
<li ><a href="edu.html">Education</a></li>
<li ><a href="abUS.html">About us</a></li>
</ul></b>
</div>
javascript css navigationbar
javascript css navigationbar
asked Nov 10 at 13:35
Niyoj oli
165
165
1
You could just use a media query. Something like@media (min-width: 700px)
and put there your.three-d:hover .three-d-box
animation if you don't want to use it below that screen width.
– ReSedano
Nov 10 at 14:26
add a comment |
1
You could just use a media query. Something like@media (min-width: 700px)
and put there your.three-d:hover .three-d-box
animation if you don't want to use it below that screen width.
– ReSedano
Nov 10 at 14:26
1
1
You could just use a media query. Something like
@media (min-width: 700px)
and put there your .three-d:hover .three-d-box
animation if you don't want to use it below that screen width.– ReSedano
Nov 10 at 14:26
You could just use a media query. Something like
@media (min-width: 700px)
and put there your .three-d:hover .three-d-box
animation if you don't want to use it below that screen width.– ReSedano
Nov 10 at 14:26
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239500%2fresponsive-navigation-box%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You could just use a media query. Something like
@media (min-width: 700px)
and put there your.three-d:hover .three-d-box
animation if you don't want to use it below that screen width.– ReSedano
Nov 10 at 14:26