I am trying to create a flipping card metro style menu, however when I tried to declare the front and back styles when you are hovering your mouse on the front div it does not look good when it shows the back div.
Here's the CSS code:
ul{
-webkit-perspective: 1000;
width: 50%;
margin: 120px auto;
}
li{
width: 200px;
height: 200px;
margin-right: 10px;
margin-bottom: 10px;
float: left;
list-style: none;
position: relative;
cursor: pointer;
font-family: 'Open Sans';
font-weight: 300;
background: #34495e;
}
div{
color: yellow;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all 0.5s ease;
-webkit-backface-visibility: hidden;
}
.front{
z-index: 3;
color: #fff;
text-align: center;
line-height: 210px;
font-size: 20px;
background: #e3e3e3;
}
.front:hover {
z-index: 0;
-webkit-transform: rotateY(180deg);
}
.back:hover {
-webkit-transform: rotateY(0deg);
}
.back{
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
}
#box1{ background: #1abc9c;}
#box2{ background: #2ecc71;}
#box3{ background: #3498db;}
#box4{ background: #f1c40f;}
#box5{ background: #e67e22;}
#box6{ background: #e74c3c;}
I am just wondering if there is a fix that we can do to make it look like the back is a part of the card cause right now it seems that it was a static face and won't move and I am just flipping front one to show the other static.
Check out the JSFiddle: http://jsfiddle.net/p6NQ2/2/
Method explanation: Initially the back face is rotated by 180 deg and when the li is hovered on, its child div.back) is rotated back into view (0 deg) while the div.front is rotated by 180 deg and thus gives it a front and back flipping effect.
You can achieve the card flip effect by doing the following changes to your CSS.
.back{
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
-webkit-transform: rotateY(180deg); /* initially it would be rotated by 180 deg */
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
background: #34495e; /* moved the background color from the li to the back element */
}
li:hover > .front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
li:hover > .back {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
}
Tested in Internet Explorer 10 & 11, Chrome v24, Firefox v19 and Safari v5.1.7 (on Windows).
Notes:
Set the -webkit-perspective: 1000; (and other browser prefixed versions) on the li rather than on the ul. When the perspective is set on the ul, it is common for all child elements of the ul and the perspective is from the view point of the parent ul. When it is applied on the li it is from the view point of each individual li and hence produces the same effect on each li. Refer to this thread for more details on the difference.
We are adding the flip effect on the hover of the container li instead of the .front element because since the .front element is also being rotated, it would cause a very jittery effect.
Demo with hover on LI
body {
background: #ecf0f1;
}
ul {
width: 50%;
margin: 120px auto;
}
li {
width: 200px;
height: 200px;
margin-right: 10px;
margin-bottom: 10px;
float: left;
list-style: none;
position: relative;
cursor: pointer;
font-family: 'Open Sans';
font-weight: 300;
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
div {
color: yellow;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.front {
z-index: 3;
color: #fff;
text-align: center;
line-height: 210px;
font-size: 20px;
background: #e3e3e3;
}
li:hover > .front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
li:hover > .back {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.back {
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
background: #34495e;
}
#box1 {
background: #1abc9c;
}
#box2 {
background: #2ecc71;
}
#box3 {
background: #3498db;
}
#box4 {
background: #f1c40f;
}
#box5 {
background: #e67e22;
}
#box6 {
background: #e74c3c;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"/>
<ul>
<li>
<div class="front" id="box1"><i class="fa fa-home fa-2x"> </i>
</div>
<div class="back">Home</div>
</li>
<li>
<div class="front" id="box2"><i class="fa fa-user fa-2x"></i>
</div>
<div class="back">About</div>
</li>
<li>
<div class="front" id="box3"><i class="fa fa-briefcase fa-2x"></i>
</div>
<div class="back">Portfolio</div>
</li>
<li>
<div class="front" id="box4"><i class="fa fa-desktop fa-2x"></i>
</div>
<div class="back">Services</div>
</li>
<li>
<div class="front" id="box5"><i class="fa fa-cubes fa-2x"></i>
</div>
<div class="back">Products</div>
</li>
<li>
<div class="front" id="box6"><i class="fa fa-envelope fa-2x"></i>
</div>
<div class="back">Contact</div>
</li>
</ul>
Jittery demo with hover on front div
body {
background: #ecf0f1;
}
ul {
width: 50%;
margin: 120px auto;
}
li {
width: 200px;
height: 200px;
margin-right: 10px;
margin-bottom: 10px;
float: left;
list-style: none;
position: relative;
cursor: pointer;
font-family:'Open Sans';
font-weight: 300;
-webkit-perspective: 1000;
}
div {
color: yellow;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all 0.5s ease;
-webkit-backface-visibility: hidden;
}
.front {
z-index: 3;
color: #fff;
text-align: center;
line-height: 210px;
font-size: 20px;
background: #e3e3e3;
}
.front:hover {
z-index: 0;
-webkit-transform: rotateY(180deg);
}
.front:hover + .back {
-webkit-transform: rotateY(0deg);
}
.back {
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
-webkit-transform: rotateY(180deg);
background: #34495e;
}
#box1 {
background: #1abc9c;
}
#box2 {
background: #2ecc71;
}
#box3 {
background: #3498db;
}
#box4 {
background: #f1c40f;
}
#box5 {
background: #e67e22;
}
#box6 {
background: #e74c3c;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"/>
<ul>
<li>
<div class="front" id="box1"><i class="fa fa-home fa-2x"> </i>
</div>
<div class="back">Home</div>
</li>
<li>
<div class="front" id="box2"><i class="fa fa-user fa-2x"></i>
</div>
<div class="back">About</div>
</li>
<li>
<div class="front" id="box3"><i class="fa fa-briefcase fa-2x"></i>
</div>
<div class="back">Portfolio</div>
</li>
<li>
<div class="front" id="box4"><i class="fa fa-desktop fa-2x"></i>
</div>
<div class="back">Services</div>
</li>
<li>
<div class="front" id="box5"><i class="fa fa-cubes fa-2x"></i>
</div>
<div class="back">Products</div>
</li>
<li>
<div class="front" id="box6"><i class="fa fa-envelope fa-2x"></i>
</div>
<div class="back">Contact</div>
</li>
</ul>
Maybe something like this:
CSS Flip: DEMO
I added two new classes: Flipper , Flip Container.
.flip-container {
perspective: 1000;
}
/* flip when hovered */
.flip-container:hover .flipper, .flip-container.hover .flipper {
transform: rotateY(180deg);
}
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
Additional Info:
I've embedded Aerotwist's | Paul Lewis's Graphical CSS FLIP including jQuery.
It's really cool and you might find it more helpful:
there is a CSS code inside, which divides to two parts, first, is the "Movement" of the "Card", the second is the main style.css. I'd suggest you separate one from another.
CSS: 3D Flip: JSFIDDLE
Good Luck!
Related
I'm trying to hover over a div and change another when they are within a flex wrapper.
I want to hover over the <li> elements to expand other divs in the wrapper.
Specifically the li links in the navbar that respectively goes to the inner divs.
code pen example :
https://codepen.io/popados/pen/JjpyvqO
EDIT: The code pen shows an example that works if you hover the wrapper but not the div I want to (the home button).
Ideally, I would like to expand the about author box to 1024 x 768 while hovering one of the li element divs.
EDIT 2: Added a comment down below. Images added. Shows what the expected output should be. Changed HTML to remove around a li element.
a {
text-decoration: none;
color: green;
}
header {
background-color: black;
border-bottom: 1px solid red;
}
.wrapper {
display: flex;
width: 1024px;
height: 768px;
}
a:visited {
color: green;
}
ul {
list-style: none;
flex-direction: column;
}
li {
border: 2px solid red;
list-style: none;
padding: 25px;
}
.nav-bar {
background-color: black;
color: red;
position: relative;
height: 100%;
width: 200px;
}
.nav-bar-text {
height: 125px;
text-align: center;
font-size: 32px;
vertical-align: middle;
border-right: 2px solid red;
}
.home {
transition: all 2s ease-out;
}
.home:hover {
background-color: rgb(71, 71, 71);
}
.wrapper:hover .about {
background-color: rgb(71, 71, 71);
}
li:hover {}
.cn-button {
width: 150px;
}
.banner {
background-color: rgb(30, 0, 255);
width: 0px;
height: 0px;
color: white;
text-align: left;
transition: all 2s ease-in;
}
.about {
background-color: orange;
width: 200px;
height: 200px;
color: white;
text-align: left;
transition: all 2s ease-in;
}
<div class="wrapper">
<div class="nav-bar">
<div class="sidebar">
<div class="nav-bar-text">
<p>Navbar Text And Logo</p>
</div>
<ul>
<li class="home">Home</li>
<li>About Author</li>
<li>Other Books</li>
<li>Quotes</li>
<li><a href=https://github.com/popados> [ Popados Github ] </a></li>
<li><button class="cn-button" id="cn-button">+</button></li>
</ul>
</div>
</div>
<div class="banner">
<h2>Book Title and Banner</h2>
</div>
<div class="about">
<h2>About Author</h2>
</div>
<div class="other-books">
<h2>Other Books</h2>
</div>
</div>
there. this is a simple code that able to solve your issue. you may implement this code to yours by editing here and there. hope it help to solve your problem.
* {
box-sizing: border-box;
}
.zoom {
float: left;
padding: 50px;
background-color: green;
transition: transform .3s;
width: 400px;
height: 100px;
margin: 0 auto;
border: 2px solid red;
}
.zoom1 {
float: left;
padding: 50px;
background-color: blue;
transition: transform .4s;
width: 400px;
height: 100px;
margin: 0 auto;
border: 2px solid red;
}
.zoom:hover {
-ms-transform: scale(1.5); /* IE 9 */
-webkit-transform: scale(1.5); /* Safari 3-8 */
transform: scale(1.5);
}
.zoom1:hover {
-ms-transform: scale(1.5); /* IE 9 */
-webkit-transform: scale(1.5); /* Safari 3-8 */
transform: scale(1.5);
}
<h1>Zoom on Hover</h1>
<p>Hover over the div element.</p>
<div class="zoom">
<h2> Menu</h2>
</div>
<div class="zoom1">
<h2> About Us</h2>
</div>
<div class="zoom">
<h2> Contact</h2>
</div>
<div class="zoom1">
<h2> Profile</h2>
</div>
So basically i want my Social Bar to be on the Right side of the Screen yet i just can't figure out why it wont move :(
Tried to mess with the Icon Bar and shiz but im still learning so i don't really know what to do
HTML
.icon-bar {
position: fixed;
top: -100%;
-webkit-transform: translateY(50%);
-ms-transform: translateY(50%);
transform: translateY(50%);
}
.icon-bar a {
display: block;
position: static;
text-align: left;
padding: 16px;
transition: all 0.3s ease;
color: white;
font-size: 20px;
}
.icon-bar a:hover {
background-color: rgb(196, 44, 44);
}
.twitter {
background: #55ACEE;
color: white;
}
.instagram {
background: #125688;
color: white;
}
.linkedin {
background: #007bb5;
color: white;
}
CSS
<!-- Social Buttons -->
<div class="icon-bar">
<i class="fa fa-twitter"></i>
<i class="fa fa-instagram"></i>
<i class="fa fa-linkedin"></i>
Change this code of css:
.icon-bar {
position: absolute;
right: 0;
}
.icon-bar {
position: fixed;
top: -100%;
-webkit-transform: translateY(50%);
-ms-transform: translateY(50%);
transform: translateY(50%);
}
The top value of -100% in icon-bar selector is causing issue in your code. By setting the value of -100% the bar is being pushed up in the viewport, to a point where it becomes invisible.
To move it to right, when you use position:fixed you should use right:0.
(In the below code I use the name of social media)
To layout your a tags, it's better to use display:flex, flex layout is the best way to layout your items on the page.
.icon-bar {
position: fixed;
/* top: -100%; */
right:0;
/*-webkit-transform: translateY(50%); //I comment this code to show element on result box.
-ms-transform: translateY(50%);
transform: translateY(50%);*/
}
.icon-bar a {
/* display: block;
position: static; */
display:flex;
text-align: left;
padding: 16px;
transition: all 0.3s ease;
color: white;
font-size: 20px;
}
.icon-bar a:hover {
background-color: rgb(196, 44, 44);
}
.twitter {
background: #55ACEE;
color: white;
}
.instagram {
background: #125688;
color: white;
}
.linkedin {
background: #007bb5;
color: white;
}
<div class="icon-bar">
twitter
instagram
linkedin
<div>
To learn more about position these links will help you:
css-tricks.com
developer.mozilla.org
About flex layout, you can read:
css-tricks.com
developer.mozilla.org
When I hover over the red box, the reddit logo stretches with it, any way to fix this? I hope the snippet will help you understand my problem. Seems like it's a problem with "translate: scaleY();", but I can't use transitions or animations because I'm making like a card and elements push each other.
* {
margin: 0;
}
li {
list-style: none;
}
#card {
width: 460px;
height: 350px;
left: 50%;
transform: translate(-50%);
position: absolute;
}
#socialLinks {
display: inline-flex;
padding: 0;
}
#socialLinks li:hover {
transform-origin: bottom;
transform: scaleY(1.1);
}
#socialLinks li {
width: 152px;
height: 100px;
border-style: solid;
border-color: rgb(43, 43, 43);
border-width: 1px;
transition-timing-function: ease-in-out;
transition-duration: 0.3s;
transform: scaleY(1);
}
#socialLink1 {
background: tomato;
}
.logoReddit {
width: 85px;
height: 75px;
}
<div id="card">
<ul id="socialLinks">
<li id="socialLink1">
<a href="#">
<img
class="logoReddit" src="https://i.ibb.co/1QWXV8g/reddit-logo.png" alt="reddit-logo">
</a>
</li>
</ul>
</div>
Try these CSS rules:
#socialLinks li .logoReddit {
transition: .3s ease-in-out;
}
#socialLinks li:hover .logoReddit {
transform: scaleY(0.9);
}
I'm building a series of flip boxes which have an image and title on the front and then on the reverse a background with some hyperlinks
All works fine on most browsers however on safari the boxes flicker for a few seconds when flipped over.
Can anyone see something I've missed?
.flip-card {
background-color: transparent;
width: 250px;
height: 250px;
perspective: 1000px;
margin-left:50px;
}
.flip-card-inner {
position: absolute;
width: 100%;
height: 100%;
text-align: left;
transition: transform 0.6s;
transform-style: preserve-3d;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}
.flip-card:hover .flip-card-inner {
transform: rotateY(181deg);
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility:hidden;
backface-visibility: hidden;
}
.flip-card-front {
background-color: black;
color: black;
}
.box-caption {
position: absolute;
top: 55%;
left: 50%;
z-index: 2;
margin-right: -50%;
transform: translate(-50%, -50%);
color: white;
text-align:center;
padding-left:25px;
padding-right:25px;
font-size: 20px;
word-wrap: break-word;
display: block;
}
.flip-card-back {
padding-top:0px;
padding-left:25px;
background:linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(8,30,37,1) 18%, rgba(50,195,192,1) 100%);;
color: white;
transform: rotateY(-180deg);
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
word-wrap: break-word;
padding-right:15px;
display: block;
font-size: 13px;
}
.flip-card-title {
padding-top:15px;
font-weight: bold;
padding-bottom: 10px;
color: white;
word-wrap: break-word;
padding-right:15px;
display: block;
font-size: 16px;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
a.one:link {
color: white !important;
text-decoration: none !important;
}
a.one:active {
color: white !important;
text-decoration: none !important;
}
a.one:hover{
color: white !important;
text-decoration: underline !important;
}
a.one:visited {
color: white !important;
text-decoration: none !important;
}
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<img src="http://philk18.sg-host.com/wp-content/uploads/2020/09/card-test.jpg" alt="Avatar" style="width:250px;height:250px;opacity:0.5;">
<div class="box-caption">
<p> <b> Lines and Wrinkles </b> </p>
</div>
</div>
<div class="flip-card-back">
<div class="flip-card-title">Lines and wrinkles</div>
<a class="one" href="/skin-boosters" target="_blank"> - Skin Boosters</a><br><a class="one" href="/derma-fillers" target="_blank"> - Derma Fillers</a>
</div>
</div>
</div>
https://codepen.io/xeddir/pen/VwaJpme
.box-caption {
z-index: 0;
}
change z-index to 0 that should fix it
I want to have a swipeable horizontal menu on my mobile website, just like Google uses on it's results page. I created one with basic html/css, which works fine but I cannot get rid of the scroll bar...
Here's the code:
<div style=" -ms-overflow-style: -ms-autohiding-scrollbar; -webkit-user-select: none; display: block; height: 50px; overflow-y: hidden; padding: 0px; position: relative; -webkit-overflow-scrolling: touch; overflow-x: scroll;">
<div style="display: inline-block; position: relative; white-space: nowrap; overflow: hidden;">
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
<div style="display: inline-block; height: 40px; text-align: center; padding: 0 16px;">ITEM</div>
</div>
</div>
Any idea?
See my menu here
See Google example here
You can make a container <div> element that holds the scrolling <div>.
This parent <div> style can be set to: oveflow:hidden and its size smaller than its child <div> -of which the style is set to overflow:scroll.
This way the scrollbar is hidden and you need not worry about doing this with JavaScript; however:
It is recommended that you create your CSS classes in either a <style> element, or a separate CSS file in which you can define these classes, and use these classes in your HTML like: <div class="menu">...
Using inline CSS as per the example above renders unmanageable code, especially in larger projects
Update
Here's a full example:
div
{
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
.scrollHider
{
display:inline-block;
width:302px;
height:162px;
overflow:hidden;
border:1px solid #AAA;
}
.menuBox
{
width:315px;
height:175px;
overflow:scroll;
white-space:nowrap;
}
.menuSection
{
width:300px;
height:160px;
display:table-cell;
overflow:hidden;
}
.menuItem
{
width:300px;
height:40px;
text-align:center;
padding:10px;
border:1px solid #AAA;
}
<div class="scrollHider">
<div class="menuBox">
<div class="menuSection">
<div class="menuItem">ITEM 1</div>
<div class="menuItem">ITEM 2</div>
<div class="menuItem">ITEM 3</div>
<div class="menuItem">ITEM 4</div>
</div>
<div class="menuSection">
<div class="menuItem">ITEM 5</div>
<div class="menuItem">ITEM 6</div>
<div class="menuItem">ITEM 7</div>
<div class="menuItem">ITEM 8</div>
</div>
</div>
</div>
Preview: (partial screenshot)
The preview (above) shows where it is scrolled to the right. Copy & paste the code above in an empty HTML file, save & open in web browser. You can also click it and use keyboard arrows to scroll if you're not using a phone/touch-screen.
First put this link in your head tags. it is from purecss.io which is a small library of css modules. I use pure in about 40% of my projects.
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
Then put this into the body of your HTML page. I would recommend separating the css and js into their own files later.
<style>
.custom-menu-wrapper {
background-color: #808080;
margin-bottom: 2.5em;
white-space: nowrap;
position: relative;
}
.custom-menu {
display: inline-block;
width: auto;
vertical-align: middle;
-webkit-font-smoothing: antialiased;
}
.custom-menu .pure-menu-link,
.custom-menu .pure-menu-heading {
color: white;
}
.custom-menu .pure-menu-link:hover,
.custom-menu .pure-menu-heading:hover {
background-color: transparent;
}
.custom-menu-top {
position: relative;
padding-top: .5em;
padding-bottom: .5em;
}
.custom-menu-brand {
display: block;
text-align: center;
position: relative;
}
.custom-menu-toggle {
width: 44px;
height: 44px;
display: block;
position: absolute;
top: 3px;
right: 0;
display: none;
}
.custom-menu-toggle .bar {
background-color: white;
display: block;
width: 20px;
height: 2px;
border-radius: 100px;
position: absolute;
top: 22px;
right: 12px;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
transition: all 0.5s;
}
.custom-menu-toggle .bar:first-child {
-webkit-transform: translateY(-6px);
-moz-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.custom-menu-toggle.x .bar {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.custom-menu-toggle.x .bar:first-child {
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.custom-menu-screen {
background-color: rgba(0, 0, 0, 0.5);
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
transition: all 0.5s;
height: 3em;
width: 70em;
position: absolute;
top: 0;
z-index: -1;
}
.custom-menu-tucked .custom-menu-screen {
-webkit-transform: translateY(-44px);
-moz-transform: translateY(-44px);
-ms-transform: translateY(-44px);
transform: translateY(-44px);
}
#media (max-width: 62em) {
.custom-menu {
display: block;
}
.custom-menu-toggle {
display: block;
display: none\9;
}
.custom-menu-bottom {
position: absolute;
width: 100%;
border-top: 1px solid #eee;
background-color: #808080\9;
z-index: 100;
}
.custom-menu-bottom .pure-menu-link {
opacity: 1;
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
transition: all 0.5s;
}
.custom-menu-bottom.custom-menu-tucked .pure-menu-link {
-webkit-transform: translateX(-140px);
-moz-transform: translateX(-140px);
-ms-transform: translateX(-140px);
transform: translateX(-140px);
opacity: 0;
opacity: 1\9;
}
.pure-menu-horizontal.custom-menu-tucked {
z-index: -1;
top: 45px;
position: absolute;
overflow: hidden;
}
}
</style>
<div class="custom-menu-wrapper">
<div class="pure-menu custom-menu custom-menu-top">
Brand
<s class="bar"></s><s class="bar"></s>
</div>
<div class="pure-menu pure-menu-horizontal pure-menu-scrollable custom-menu custom-menu-bottom custom-menu-tucked" id="tuckedMenu">
<div class="custom-menu-screen"></div>
<ul class="pure-menu-list">
<li class="pure-menu-item">Home</li>
<li class="pure-menu-item">About</li>
<li class="pure-menu-item">Contact</li>
<li class="pure-menu-item">Blog</li>
<li class="pure-menu-item">GitHub</li>
<li class="pure-menu-item">Twitter</li>
<li class="pure-menu-item">Apple</li>
<li class="pure-menu-item">Google</li>
<li class="pure-menu-item">Wang</li>
<li class="pure-menu-item">Yahoo</li>
<li class="pure-menu-item">W3C</li>
</ul>
</div>
</div>
<script>
(function (window, document) {
document.getElementById('toggle').addEventListener('click', function (e) {
document.getElementById('tuckedMenu').classList.toggle('custom-menu-tucked');
document.getElementById('toggle').classList.toggle('x');
});
})(this, this.document);
</script>